Name | litestar-granian JSON |
Version |
0.8.0
JSON |
| download |
home_page | None |
Summary | Granian plugin for Litestar |
upload_time | 2024-12-09 02:45:47 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
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/8f/1a/09d764c9a2b0d5a4263e318597d18304df03a0e7388997cc2d9d698fea3a/litestar_granian-0.8.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.8.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": "",
"digests": {
"blake2b_256": "4b575f906c540e536dd5a58a6892cdac5745d4215d92fc6d80041c60c5ac05d4",
"md5": "184353931b4dbaa7f4ae9248e0d74b8a",
"sha256": "6724b301431e095e4878306b997beb88b95a58f79dc3e720336b6c258c12d328"
},
"downloads": -1,
"filename": "litestar_granian-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "184353931b4dbaa7f4ae9248e0d74b8a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11497,
"upload_time": "2024-12-09T02:45:45",
"upload_time_iso_8601": "2024-12-09T02:45:45.158435Z",
"url": "https://files.pythonhosted.org/packages/4b/57/5f906c540e536dd5a58a6892cdac5745d4215d92fc6d80041c60c5ac05d4/litestar_granian-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f1a09d764c9a2b0d5a4263e318597d18304df03a0e7388997cc2d9d698fea3a",
"md5": "771a864d5c29240cde58c6eae9d7e381",
"sha256": "9a6e4d361ca333cd7b2aa10fa34e92fa350e5f065abc6a8e4d152f094ad48ff5"
},
"downloads": -1,
"filename": "litestar_granian-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "771a864d5c29240cde58c6eae9d7e381",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 136435,
"upload_time": "2024-12-09T02:45:47",
"upload_time_iso_8601": "2024-12-09T02:45:47.177487Z",
"url": "https://files.pythonhosted.org/packages/8f/1a/09d764c9a2b0d5a4263e318597d18304df03a0e7388997cc2d9d698fea3a/litestar_granian-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 02:45:47",
"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"
}