Litestar Socketify Plugin
[!WARNING] Socketify currently has an issue with ASGI lifespans. This plugin should be considered experimental.
Installation
pip install litestar-socketify
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_socketify import SocketifyPlugin
class SampleController(Controller):
@get(path="/sample")
async def sample_route(self ) -> dict[str, str]:
"""Sample Route."""
return {"sample": "hello-world"}
app = Litestar(plugins=[SocketifyPlugin()], route_handlers=[SampleController])
Now, you can use the standard Litestar CLI and it will run with Socketify instead of Uvicorn.
❯ litestar --app examples.basic:app run
Using Litestar app from env: 'examples.basic:app'
Starting socketify 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 │
└──────────────────────────────┴──────────────────────┘
...
Release files for litestar-socketify 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| litestar_socketify-0.1.1.tar.gz | 71.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| litestar_socketify-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.0 kB
Release files / litestar_socketify-0.1.1.tar.gz
| Download URL | litestar_socketify-0.1.1.tar.gz |
|---|---|
| Size | 71.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b7d17b4144eb3343938ff1f7c2fe0c4bc5d5a4a43b2695ee763d18641b1eeea
|
|
BLAKE2b-256 checksum How to use checksums |
4a2d7d3e148cb8e94a399bd7eec0a9df3bcf2a7116f1e359456feb185b0464ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / litestar_socketify-0.1.1-py3-none-any.whl
| Download URL | litestar_socketify-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edbe9ce2cb7230f36a1fc65e159a655010fe808dc33af1cf24d96a8012752e19
|
|
BLAKE2b-256 checksum How to use checksums |
4481c95da29ff458f2ecc91bec1185c47f743332802ced5ff07ff8e67b6dca7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|