Skip to main content

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

toypy-0.1.8.tar.gz (63.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toypy-0.1.8-py3-none-any.whl (74.8 kB view details)

Uploaded Python 3

File details

Details for the file toypy-0.1.8.tar.gz.

File metadata

  • Download URL: toypy-0.1.8.tar.gz
  • Upload date:
  • Size: 63.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.6

File hashes

Hashes for toypy-0.1.8.tar.gz
Algorithm Hash digest
SHA256 631cf8c8ff8ddbcd4ae1e9ad37b0a3425ea1666fc9cfe505166e17bd0f3c9a75
MD5 ba80f1717f7037000791577e75b3f4f1
BLAKE2b-256 34e2883098554f0ea9ece07ff756a6fd4b12bd215624aecc7876b4a0b54c7038

See more details on using hashes here.

File details

Details for the file toypy-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: toypy-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 74.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.6

File hashes

Hashes for toypy-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0e4f4741ba8fa608aecfa7c9eaf5c1a504a7f92fae42f992648e3317d185b53c
MD5 bee73cee0e3fc224cfcb0c1bbc15fea3
BLAKE2b-256 83e03ebcbd271c9a3e4ce1b70fb7c634aef8af283e26c43b4eed22541c6add58

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

This release

0.1.8 This release

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page