Run Litestar applications with Granian while preserving Litestar startup, shutdown, logging, and server integrations.
Project description
Litestar Granian
Run Litestar applications with Granian while preserving Litestar startup, shutdown, logging, and server integrations.
Install
python -m pip install litestar-granian
Run your first app
Save this as example.py:
from litestar import Litestar, get
from litestar_granian import GranianPlugin
@get("/")
async def hello() -> dict[str, str]:
return {"hello": "world"}
app = Litestar(route_handlers=[hello], plugins=[GranianPlugin()])
Start the server:
litestar --app example:app run
Open http://127.0.0.1:8000/ in a browser, or run:
curl http://127.0.0.1:8000/
You should receive:
{"hello":"world"}
Press Ctrl+C in the server terminal to stop it.
Why use this plugin?
- Keep the familiar
litestar runcommand while using Granian. - Start Litestar server integrations once around all Granian workers.
- Configure workers, protocols, logging, metrics, and static files from one CLI.
What the plugin changes
GranianPlugin() replaces Litestar's standard run command with a
Granian-backed command. It does not change commands that start another ASGI
server directly.
Run the complete command reference with:
litestar --app example:app run --help
Optional event loops
The default installation uses Granian's standard loop selection and installs no optional event loop. Install and select one integration at a time:
python -m pip install "litestar-granian[uvloop]"
litestar --app example:app run --loop uvloop
On supported platforms, use the matching rloop or winloop extra and pass
--loop rloop or --loop winloop.
Next steps
- Quickstart — repeat the first run and learn what to check.
- Configuration — choose bindings, workers, protocols, TLS, reload, and event loops.
- Logging and metrics — see how Granian automatically matches Litestar's formatter or accepts a complete override.
- Deployment — forward signals and verify clean shutdown.
- CLI reference — browse every option and environment variable.
License
litestar-granian is distributed under the MIT 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 litestar_granian-0.16.0b1.tar.gz.
File metadata
- Download URL: litestar_granian-0.16.0b1.tar.gz
- Upload date:
- Size: 221.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ad6b23b7f54dbbea3849ea5017392fcedc47ffea572b0ec5263aa4a47026f5c
|
|
| MD5 |
8c02808effdbca677de49567a00e8ce9
|
|
| BLAKE2b-256 |
264648fabed2d82aadc98e02c481a7fc79f606d0e903416bb56319a219f4ff02
|
Provenance
The following attestation bundles were made for litestar_granian-0.16.0b1.tar.gz:
Publisher:
publish.yml on cofin/litestar-granian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_granian-0.16.0b1.tar.gz -
Subject digest:
1ad6b23b7f54dbbea3849ea5017392fcedc47ffea572b0ec5263aa4a47026f5c - Sigstore transparency entry: 2240214318
- Sigstore integration time:
-
Permalink:
cofin/litestar-granian@7cb2eb12d746ba0bd7fa10351b0ecaa88af9a6e0 -
Branch / Tag:
refs/tags/v0.16.0-beta1 - Owner: https://github.com/cofin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7cb2eb12d746ba0bd7fa10351b0ecaa88af9a6e0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file litestar_granian-0.16.0b1-py3-none-any.whl.
File metadata
- Download URL: litestar_granian-0.16.0b1-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54c3a22a1548f42cdfa5915e825a33f8ac299f27b2be3bcddaef4ddb55f31832
|
|
| MD5 |
6677403bd73374e19ae11f8ff79adc4a
|
|
| BLAKE2b-256 |
a508390ee2981c2e591b5774ad687d7672396c5ccd0ccb560f5257a2c569f704
|
Provenance
The following attestation bundles were made for litestar_granian-0.16.0b1-py3-none-any.whl:
Publisher:
publish.yml on cofin/litestar-granian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_granian-0.16.0b1-py3-none-any.whl -
Subject digest:
54c3a22a1548f42cdfa5915e825a33f8ac299f27b2be3bcddaef4ddb55f31832 - Sigstore transparency entry: 2240214673
- Sigstore integration time:
-
Permalink:
cofin/litestar-granian@7cb2eb12d746ba0bd7fa10351b0ecaa88af9a6e0 -
Branch / Tag:
refs/tags/v0.16.0-beta1 - Owner: https://github.com/cofin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7cb2eb12d746ba0bd7fa10351b0ecaa88af9a6e0 -
Trigger Event:
release
-
Statement type: