A minimal WSGI routing toolkit for small services and tests.
Project description
wsgiven
wsgiven is a small WSGI toolkit: route PATH_INFO with regular expressions, stack middlewares, and optionally wrap handlers with shared utilities (for example JSON responses or centralized error handling).
The package has no runtime dependencies beyond the Python standard library.
Requirements
- Python 3.10 or newer
Install
From a clone of this repository:
uv pip install .
Or with pip:
pip install .
Quick example
from wsgiven import Application
from wsgiven.middlewares import handle_error
from wsgiven.utils.wsgi import jsonify
def hello(application, environ, start_fn):
status = "200 OK"
body, headers = jsonify({"message": "hello"})
return status, body, headers
app = Application(
routes={r"^/$": hello},
middlewares=[handle_error],
)
Use it with any WSGI server (for example Gunicorn, uWSGI, or wsgiref.simple_server for local runs).
Development
Clone the repository, then install dev dependencies (uses the committed uv.lock) and run checks:
uv sync --locked
uv run ruff check wsgiven tests
uv run ruff format --check wsgiven tests
uv run pytest
To refresh dev dependencies and regenerate the lockfile:
uv lock --upgrade
To apply Ruff formatting (instead of only checking):
uv run ruff format wsgiven tests
Contributing
Issues and pull requests (including from forks) are welcome. Please run uv run ruff check, uv run ruff format --check, and uv run pytest before submitting a change.
Releases: PyPI uploads are done only via this repository’s release workflow when a maintainer pushes a version tag. Forks and outside contributors cannot trigger that path for this repo. If you grant write access to collaborators, restrict the GitHub pypi environment with required reviewers so only you (or chosen maintainers) can approve a publish run.
License
MIT — see LICENSE.
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 wsgiven-1.1.0.tar.gz.
File metadata
- Download URL: wsgiven-1.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37db61acb62c08c6e12ca427661cfd3fce85f83022b3bb2924914d27a2cd4c69
|
|
| MD5 |
197fdae17b95fa14655eeadefed2e9d1
|
|
| BLAKE2b-256 |
22a669b5a65f5eab379541bc58df69793ae6b3b98cf8d36e667bb7ac6c318271
|
File details
Details for the file wsgiven-1.1.0-py3-none-any.whl.
File metadata
- Download URL: wsgiven-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1db8a32e4f00e8ff54ba47af6426b0bad4b9b53e86dda2b1d8242099cb3d209
|
|
| MD5 |
4750e56ae5c88468d575070ec598de6f
|
|
| BLAKE2b-256 |
abeb85b8c097574c8d906a6130defe8713e175f52b08b07f81665a4c847747ac
|