Skip to main content

Granian plugin for Litestar

Project description

Litestar Granian Plugin

Installation

pip install litestar-granian

Usage

Here is a basic application that demonstrates how to use the plugin.

from __future__ import annotations

from litestar import Controller, Litestar, get

from litestar_granian import GranianPlugin


class SampleController(Controller):
    @get(path="/sample")
    async def sample_route(self ) -> dict[str, str]:
        """Sample Route."""
        return {"sample": "hello-world"}


app = Litestar(plugins=[GranianPlugin()], route_handlers=[SampleController])

Now, you can use the standard Litestar CLI and it will run with Granian instead of Uvicorn.

 litestar --app examples.basic:app run
Using Litestar app from env: 'examples.basic:app'
Starting granian server process ──────────────────────────────────────────────
┌──────────────────────────────┬──────────────────────┐
│ Litestar version              2.1.1                │
│ Debug mode                    Disabled             │
│ Python Debugger on exception  Disabled             │
│ CORS                          Disabled             │
│ CSRF                          Disabled             │
│ OpenAPI                       Enabled path=/schema │
│ Compression                   Disabled             │
└──────────────────────────────┴──────────────────────┘
[INFO] Starting granian
[INFO] Listening at: 127.0.0.1:8000
[INFO] Spawning worker-1 with pid: 2719082
[INFO] Started worker-1
[INFO] Started worker-1 runtime-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

litestar_granian-0.15.0.tar.gz (198.8 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.15.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: litestar_granian-0.15.0.tar.gz
  • Upload date:
  • Size: 198.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for litestar_granian-0.15.0.tar.gz
Algorithm Hash digest
SHA256 50092e471f6b5308e45fbc2eb0270f819947e2a32da49e55aed31bcac4bf7425
MD5 a4dc4ae2f9785d10adfcedc406409959
BLAKE2b-256 af3d3d938ffe09154c2da674f431dbf044ad4694ade17ad83284d57a60aa5367

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_granian-0.15.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.15.0-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_granian-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 206c20979bb5602b9ed893aea58fb1d7b0227b86dca9efbcfac5fb14d6abc97f
MD5 d168178b5906062f39c0e80bd9cde783
BLAKE2b-256 7c628a1ce31098edb2349efa3635dc0db9084e0e1290317add0c4941cfbbc533

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_granian-0.15.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.

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