Create an isolated environment
Use Python 3.11 or newer. The commands below are for a macOS or Linux shell. On Windows, activate the virtual environment with the command appropriate to your shell. Install the adapter in that environment so its gramlot command is the Python command.
The scaffold creates the host, dependencies and paired Page/Logic files. Follow the commands it prints; the host guide is the authority for adapter-specific options.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install "gramlot-py-server[uvicorn]"
gramlot uvicorn new hello
cd hello
python -m pip install -r requirements.txt
uvicorn app:applicationMake a change you can explain
Open the address printed by the server. Read pages/index.py and pages/index.js side by side: Page describes the interface and names behavior; Logic implements browser methods. The generated project uses named Logic and a strict Content Security Policy.
Edit a visible text declaration in the Python file. Save, restart the server and reload the browser. Development reload has its own settings; a browser refresh alone need not reload imported Python modules.
Your turn
Try it yourself
- Create the hello project in a new or empty folder.
- Change one literal caption in pages/index.py, restart and reload.
- Confirm that the caption changed and that the original interaction still works.
Check your understanding
Where would you look to change a named browser calculation?
Show the answer and expected result
In the matching JavaScript Logic module. Python supplies the declaration and its arguments; the browser executes the named method. Keep the generated strict profile rather than copying inline code into it without understanding its requirements.