litestar-granian


Namelitestar-granian JSON
Version 0.10.0 PyPI version JSON
download
home_pageNone
SummaryGranian plugin for Litestar
upload_time2025-02-03 01:27:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords asgi granian litestar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Litestar Granian Plugin

## Installation

```shell
pip install litestar-granian
```

## Usage

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

```python
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.

```shell
❯ 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
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "litestar-granian",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "asgi, granian, litestar",
    "author": null,
    "author_email": "Cody Fincher <cody@litestar.dev>",
    "download_url": "https://files.pythonhosted.org/packages/5d/17/071a98c2da53ab9b4a5f0e05f5dc7d8837169200cd41c5d145572ca3050a/litestar_granian-0.10.0.tar.gz",
    "platform": null,
    "description": "# Litestar Granian Plugin\n\n## Installation\n\n```shell\npip install litestar-granian\n```\n\n## Usage\n\nHere is a basic application that demonstrates how to use the plugin.\n\n```python\nfrom __future__ import annotations\n\nfrom litestar import Controller, Litestar, get\n\nfrom litestar_granian import GranianPlugin\n\n\nclass SampleController(Controller):\n    @get(path=\"/sample\")\n    async def sample_route(self ) -> dict[str, str]:\n        \"\"\"Sample Route.\"\"\"\n        return {\"sample\": \"hello-world\"}\n\n\napp = Litestar(plugins=[GranianPlugin()], route_handlers=[SampleController])\n\n```\n\nNow, you can use the standard Litestar CLI and it will run with Granian instead of Uvicorn.\n\n```shell\n\u276f litestar --app examples.basic:app run\nUsing Litestar app from env: 'examples.basic:app'\nStarting granian server process \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Litestar version             \u2502 2.1.1                \u2502\n\u2502 Debug mode                   \u2502 Disabled             \u2502\n\u2502 Python Debugger on exception \u2502 Disabled             \u2502\n\u2502 CORS                         \u2502 Disabled             \u2502\n\u2502 CSRF                         \u2502 Disabled             \u2502\n\u2502 OpenAPI                      \u2502 Enabled path=/schema \u2502\n\u2502 Compression                  \u2502 Disabled             \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n[INFO] Starting granian\n[INFO] Listening at: 127.0.0.1:8000\n[INFO] Spawning worker-1 with pid: 2719082\n[INFO] Started worker-1\n[INFO] Started worker-1 runtime-1\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Granian plugin for Litestar",
    "version": "0.10.0",
    "project_urls": {
        "Changelog": "https://cofin.github.io/litesatr-granian/latest/changelog",
        "Discord": "https://discord.gg/X3FJqy8d2j",
        "Documentation": "https://cofin.github.io/litesatr-granian/latest/",
        "Homepage": "https://cofin.github.io/litesatr-granian/latest/",
        "Issue": "https://github.com/cofin/litestar-granian/issues/",
        "Source": "https://github.com/cofin/litestar-granian"
    },
    "split_keywords": [
        "asgi",
        " granian",
        " litestar"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "18837549e7b71ea7e3e0daacbe6498b37403e446481c2e3ec98cbe723cff28f3",
                "md5": "077e1b908143413ebd9eb901027c9ddc",
                "sha256": "d10844fa0c9d9a443d7843c18f76430adb70340a139a8ec2c23ceb8a3a0cea9a"
            },
            "downloads": -1,
            "filename": "litestar_granian-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "077e1b908143413ebd9eb901027c9ddc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11470,
            "upload_time": "2025-02-03T01:27:00",
            "upload_time_iso_8601": "2025-02-03T01:27:00.626893Z",
            "url": "https://files.pythonhosted.org/packages/18/83/7549e7b71ea7e3e0daacbe6498b37403e446481c2e3ec98cbe723cff28f3/litestar_granian-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5d17071a98c2da53ab9b4a5f0e05f5dc7d8837169200cd41c5d145572ca3050a",
                "md5": "bb7cf12b6d7a48742f2d064547a85158",
                "sha256": "9463599716989095467ecf43170727805cc831713582899d18b65bb8993de98a"
            },
            "downloads": -1,
            "filename": "litestar_granian-0.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bb7cf12b6d7a48742f2d064547a85158",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 178556,
            "upload_time": "2025-02-03T01:27:02",
            "upload_time_iso_8601": "2025-02-03T01:27:02.715727Z",
            "url": "https://files.pythonhosted.org/packages/5d/17/071a98c2da53ab9b4a5f0e05f5dc7d8837169200cd41c5d145572ca3050a/litestar_granian-0.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-03 01:27:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cofin",
    "github_project": "litestar-granian",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "litestar-granian"
}
        
Elapsed time: 0.60077s