bolinette-web
The Bolinette web extension: an ASGI application built from controllers and routes.
A controller is a class, a route is one of its methods, and everything the method needs is injected, including the path parameters, the query string and the request payload. Each request gets its own injector scope, so a scoped service lives exactly as long as the request that asked for it.
from typing import Annotated
from bolinette.web import Controller, Payload, PathParam, controller, get, post
@controller("items")
class ItemController(Controller):
@get("{item_id}")
async def one(self, item_id: Annotated[int, PathParam()]) -> ItemResponse: ...
@post("")
async def create(self, payload: Annotated[ItemPayload, Payload()]) -> ItemResponse: ...
Installation
$ pip install bolinette-web # or use your preferred package manager
$ pip install bolinette-web[auth] # with the bundled JWT provider
Requirements
Bolinette-web requires Python 3.13 (or newer), and depends on bolinette.
The auth extra adds pyjwt with its cryptography backend, and is only needed for the bundled authentication provider.
What the web extension does
- Controllers and routes —
controllermounts a class on a path, andget,post,put,patchanddeletemount its methods under it. A path segment can carry a regular expression, written after a colon. - Injected request data —
PathParam,QueryParamandPayloadmark the parameters read from the request; anything unannotated is a service. Each falls back from the request value to the default, then toNoneif the type allows it, then to aBadRequestError. - Typed responses — a route returns whatever it wants, encoded as JSON through the core mapper.
- Middlewares —
with_middlewarewraps a controller or a single route,without_middlewaretakes one off a route that inherited it. - Authentication — the
authextra ships a JWT provider, enabled throughWebExtension(blnt_auth=...), withblnt auth new rsato generate its keys. - WebSockets — handlers declared like routes, with the same injection, and subscriptions released when the connection closes.
- A server, not bundled —
create_asgi_appturns the application factory into the callable uvicorn or hypercorn runs.
from bolinette.web import create_asgi_app
from my_app import make_bolinette
app = create_asgi_app(make_bolinette)
License
Bolinette is released under the MIT license, see LICENSE.txt.
Metadata
Release files for bolinette-web 0.20.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bolinette_web-0.20.0.tar.gz | 29.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bolinette_web-0.20.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.3 kB
Release files / bolinette_web-0.20.0.tar.gz
| Download URL | bolinette_web-0.20.0.tar.gz |
|---|---|
| Size | 29.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a84f9926d0057534bf907d0c2bbf537d23c03531121fe11a55c8d47a08ba05d
|
|
BLAKE2b-256 checksum How to use checksums |
43266882cb071269c8e5f7291a52dbe230a74f0a0d7d88ce58334625d7b42fdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","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}
|
Release files / bolinette_web-0.20.0-py3-none-any.whl
| Download URL | bolinette_web-0.20.0-py3-none-any.whl |
|---|---|
| Size | 44.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
820b94412376afe618fd5cf817cfecd79456c99be23294e2edbdaca4a4bc9326
|
|
BLAKE2b-256 checksum How to use checksums |
1b97c173d43af91193e1fb769e71b80ed187eeac7cd3c23f109dd7b71acb99e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","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}
|