litestar-granian


Namelitestar-granian JSON
Version 0.2.6 PyPI version JSON
download
home_pageNone
SummaryGranian plugin for Litestar
upload_time2024-04-01 17:30:40
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.fincher@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ba/a3/85f719d5855d8094104582cf53d71a91c453d452ba624479aed947658c16/litestar_granian-0.2.6.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.2.6",
    "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": "",
            "digests": {
                "blake2b_256": "d943860730613e90af4bc3cc2bb9edbba68473b1ab37d52d43b80c1e2867e2e9",
                "md5": "1daf694f610177ff459c99bada9eda9b",
                "sha256": "d26446d5892ab235cedc6b6426f62245e71296458f167fcd538408e53045b71c"
            },
            "downloads": -1,
            "filename": "litestar_granian-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1daf694f610177ff459c99bada9eda9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8516,
            "upload_time": "2024-04-01T17:30:38",
            "upload_time_iso_8601": "2024-04-01T17:30:38.806618Z",
            "url": "https://files.pythonhosted.org/packages/d9/43/860730613e90af4bc3cc2bb9edbba68473b1ab37d52d43b80c1e2867e2e9/litestar_granian-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "baa385f719d5855d8094104582cf53d71a91c453d452ba624479aed947658c16",
                "md5": "7dc1214573a302a6575db4c0770b4dc8",
                "sha256": "88a397b2e8f74b1aa2683a203637783919e8cf94227846664499664126038e40"
            },
            "downloads": -1,
            "filename": "litestar_granian-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "7dc1214573a302a6575db4c0770b4dc8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 62772,
            "upload_time": "2024-04-01T17:30:40",
            "upload_time_iso_8601": "2024-04-01T17:30:40.416079Z",
            "url": "https://files.pythonhosted.org/packages/ba/a3/85f719d5855d8094104582cf53d71a91c453d452ba624479aed947658c16/litestar_granian-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-01 17:30:40",
    "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.21197s