The opinionated Indie Maker Python web framework for shipping MVPs stupid-fast.
Project description
Shipy
Tiny Python web toolkit + CLI.
- App, Request, Response, routing (imperative)
- Jinja2 templates via
shipy.render.render() - SQLite helpers in
shipy.sql(query,one,execute,tx) - Signed-cookie sessions with CSRF + flash in
shipy.session - CLI:
shipy new,shipy dev,shipy db apply,shipy deploy
Note: The SQL write helper is named execute (not exec, since exec is a Python keyword).
Quick start
- Install dependencies:
pip install jinja2 itsdangerous uvicorn watchfiles - Scaffold a new app:
shipy new myappcd myappshipy dev
- Or try the included example:
cd examples/helloshipy dev(uses uvicorn + autoreload if installed)- Or:
uvicorn examples.hello.app.main:asgi --reload
Example
See examples/hello/app/main.py:1 and examples/hello/app/views/home/index.html:1.
CLI
shipy new <name>— creates a scaffolded project in./<name>shipy dev [--app app.main:app] [--host 127.0.0.1] [--port 5000]shipy db apply [--db ./db/app.db] [--schema db/schema.sql]shipy deploy— placeholder helper
Templates
Default template root is app/views. Use shipy.render.render('path/to/template.html', ctx, request=req).
Sessions
Session data is stored in a signed cookie using itsdangerous. Set SHIPY_SECRET in your environment for production.
Flash messages are available via req.session.flash(message, category) and req.session.get_flashed_messages() in requests. CSRF token via req.session.get_csrf_token().
Database
SQLite helpers in shipy/sql.py:1 use ./db/app.db by default (created as needed).
query(sql, params=()) -> list[dict]one(sql, params=()) -> dict | Noneexecute(sql, params=()) -> intwith tx() as conn: conn.execute(...)
Apply schema with shipy db apply --schema db/schema.sql.
License
MIT — see LICENSE:1.
Project details
Release history Release notifications | RSS feed
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 shipy_web-0.2.0.tar.gz.
File metadata
- Download URL: shipy_web-0.2.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8ab6774f08bc4c130f84e0c2b2c7c5cee072afd3fc628731a9fbdbc762d5a9c
|
|
| MD5 |
2533e510a2996c27ec721b8e9b296011
|
|
| BLAKE2b-256 |
40a286308f37bb092d194ad1601330f206a03878ac20174a9867a1b71020de7a
|
File details
Details for the file shipy_web-0.2.0-py3-none-any.whl.
File metadata
- Download URL: shipy_web-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de5f852c124b2a448d8f8298ad65ac2f566bb15d6168c6d56370300e1f180c32
|
|
| MD5 |
eab5171b05b2e69b9e2e5494c6846adf
|
|
| BLAKE2b-256 |
7440b610ac32344d1e18d8bcbf66ed9f50b539627b3dfb594e8a251275ce98b1
|