Skip to main content

The opinionated Indie Maker Python web framework for shipping MVPs stupid-fast.

Project description

Shipy

The opinionated Indie Maker Python web framework for shipping MVPs stupid-fast.

  • App, Request, Response, routing (imperative)
  • Jinja2 templates via shipy.render.render()
  • SQLite helpers in shipy.sql (query, one, execute, tx)
  • Built-in auth with users/sessions
  • Signed-cookie sessions with CSRF + flash in shipy.session
  • CLI: shipy new, shipy dev, shipy db init, shipy deploy

Note: The SQL write helper is named execute (not exec, since exec is a Python keyword).

Quick start

pip install shipy-web
shipy new myapp && cd myapp
shipy db init
shipy dev

Visit http://localhost:8000 and sign up to get started!

Example

See examples/hello/app/main.py:1 and examples/hello/app/views/home/index.html:1.

CLI

  • shipy new <name> — creates an auth-first scaffolded project in ./<name>
  • shipy dev [--app app.main:app] [--host 127.0.0.1] [--port 8000]
  • shipy db init [--db ./data/app.db] [--schema data/schema.sql] — initialize database
  • shipy db path — show resolved database path
  • shipy deploy — deployment helpers

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 ./data/app.db by default (created as needed).

Override the database path with SHIPY_DB environment variable:

SHIPY_DB=/path/to/custom.db shipy dev
  • query(sql, params=()) -> list[dict]
  • one(sql, params=()) -> dict | None
  • execute(sql, params=()) -> int
  • with tx() as conn: conn.execute(...)

Apply schema with shipy db init --schema data/schema.sql.

License

MIT — see LICENSE:1.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shipy_web-0.2.2.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

shipy_web-0.2.2-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file shipy_web-0.2.2.tar.gz.

File metadata

  • Download URL: shipy_web-0.2.2.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for shipy_web-0.2.2.tar.gz
Algorithm Hash digest
SHA256 223c7be01561aff2b496f90da471d53704b3f9e8c403f2023a25d3ce0ebba712
MD5 6bbc1f00db568adac62e490d69cfed7f
BLAKE2b-256 706c3cee254c8aed4ce0da866bb72df0f1dd2fb48d80e41b8105a50633f9b36c

See more details on using hashes here.

File details

Details for the file shipy_web-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: shipy_web-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for shipy_web-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7dfaa930194f2991f82ff8f1dd949fcf2e9b8e7ce88cee7e254fba03887fc137
MD5 3e7dc2cd2f5fc7a7b0fa635a44ffefe8
BLAKE2b-256 7e945e7b5dd28d7351bdd97959f5ef9c64f353847c403edae49a7ce789f1496a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page