Skip to main content

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 run command 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.

Download files

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

Source Distribution

litestar_granian-0.16.0.tar.gz (235.5 kB view details)

Uploaded Source

Built Distribution

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

litestar_granian-0.16.0-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file litestar_granian-0.16.0.tar.gz.

File metadata

  • Download URL: litestar_granian-0.16.0.tar.gz
  • Upload date:
  • Size: 235.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for litestar_granian-0.16.0.tar.gz
Algorithm Hash digest
SHA256 794691dc44faee2f0d2b17826c8ef9be67709581a60a2ec6ccbeaa9038db0010
MD5 496f398fc8b0e87c4eb2862e808637ef
BLAKE2b-256 85618e01fd03ad103237439baea5b2a8c28b4630cd3bbaf5d001ae8a58e3ee93

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_granian-0.16.0.tar.gz:

Publisher: publish.yml on cofin/litestar-granian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file litestar_granian-0.16.0-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_granian-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14c525acb8f53f90218ac83690e290017e44215d299cd24c124722890a62f2f3
MD5 b9c505a1d18956007c12c0367f7f9eb5
BLAKE2b-256 83ab4e402061c627bfc73d8eb0597364e01797bdf73aa8d1accfafba6e44a514

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_granian-0.16.0-py3-none-any.whl:

Publisher: publish.yml on cofin/litestar-granian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 files

0.15.0

2 files

0.14.2

2 files

0.14.1

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.3

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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