Run your first Python app
Deploy a Python HTTP server and verify its response on a Wendy target.
Deploy a small HTTP server, check its response, then change the response and redeploy. This is the starting project for adding an API endpoint.
Prerequisites
- Wendy CLI installed on your development computer.
- Docker running with Buildx. Check with
docker infoanddocker buildx version. - A Linux device or WendyOS VM ready to run your app.
Python and dependencies run inside the container. You do not need Python installed on your development computer. Use the VM setup guide if you do not have hardware; this tutorial also works with an existing Linux machine running Wendy Agent.
1. Create the project
wendy init hello-world --target wendyos --language python --template simple-api --var APP_ID=hello-world --var PORT=3001 --assistant skip --git-init no
cd hello-worldThe template creates app.py, Dockerfile, and wendy.json. The application
uses FastAPI; the Dockerfile installs its dependencies and starts it with
Uvicorn. wendy.json declares network
access, a readiness check on port 3001, and a hook to open the browser.
2. Deploy and check the response
wendy runFor an unenrolled local-only Linux agent, run wendy run --device 127.0.0.1:50051
on that computer instead. Otherwise select your target. Wendy builds and deploys the server, checks readiness, and
opens its URL. Open the address printed by Wendy if the browser does not open.
The root page should return:
{"message":"hello-world"}Use the printed address, including its port. A local VM normally uses a forwarded address on your development computer; a physical device uses its own address. If the build, connection, or readiness check fails, use first-deployment troubleshooting.
3. Change the response
In app.py, find the function decorated with @app.get("/"). Change its return
value to:
return {"message": "Hello from my device"}Stop the attached CLI with Ctrl+C. Watch mode does not show a device picker.
Replace your-device.local with the hostname or IP from wendy discover, or
use vm:<name> with the name from wendy vm list. For an unenrolled local-only
Linux agent, use 127.0.0.1:50051. Keep this terminal for the
remaining commands; the variable identifies the agent, not the app's HTTP URL.
WENDY_TARGET='your-device.local'
wendy run --device "$WENDY_TARGET" --watchRefresh the browser and check for the new message. Further edits trigger a rebuild and deployment when you save. This verifies that your source change reached the target.
Finish or continue
Ctrl+C ends the attached CLI session. To stop the deployed app, run:
wendy --device "$WENDY_TARGET" device apps stop hello-worldIf you used a VM and are finished with it, find its name with wendy vm list
and stop it with wendy vm stop <name>.
Keep this project for the next tutorial: add an endpoint that validates input and calculates a result.