Toy
Express-like Python backend for beginners — MongoDB, JWT, WebSockets, nested file routing.
Default port: 313.
Install
pip install toypy
Create a project
mkdir my-api
cd my-api
toy make
python main.py
Or: toy run
Beginner style
Put this one line at the top of files you edit (main.py, routes, controllers):
from toy.injected import * # framework wiring — you can ignore this line
db = connect_mongo()
use("/api", "routes/api.py")
@get("/health")
def health(req):
return makeResponse(200, data={"ok": True})
app.run(host=settings.HOST, port=settings.PORT, reload=settings.RELOAD)
With RELOAD = True in settings.py, saving a file restarts the server automatically. Set RELOAD = False in production.
Nest routes up to 5 layers with use("/prefix", "file.py").
Attach controllers like Node: get("/", usersController.list).
See START_HERE.md and toy help first after toy make. Full docs in docs/.
Commands
toy make # scaffold project
toy make --force # overwrite scaffold files
toy run # run main.py with the loader
toy --help
toy --version
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toypy-0.1.20.tar.gz.
File metadata
- Download URL: toypy-0.1.20.tar.gz
- Upload date:
- Size: 951.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83220a58b981b56e80ea19448ef77390131e94f9502d5c5d31e963455879be0a
|
|
| MD5 |
2e66f5db29ecbd055799e1732ca2d123
|
|
| BLAKE2b-256 |
910ab434caccd5fdb0938361c5ae88e5e261526ba091782deca9410562fb7dc9
|
File details
Details for the file toypy-0.1.20-py3-none-any.whl.
File metadata
- Download URL: toypy-0.1.20-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08054963db58074110a82689717a4ca390bcbf951b17ff35f869e73fec8fa12b
|
|
| MD5 |
ed6af91483d103adc0414c05ecded536
|
|
| BLAKE2b-256 |
7f652c85dd6071d22d537f2fb85e763a7268fd076f79df9e9d83103bed84e1f1
|