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 │
└──────────────────────────────┴──────────────────────┘
...
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
litestar_socketify-0.1.1.tar.gz
(71.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file litestar_socketify-0.1.1.tar.gz.
File metadata
- Download URL: litestar_socketify-0.1.1.tar.gz
- Upload date:
- Size: 71.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b7d17b4144eb3343938ff1f7c2fe0c4bc5d5a4a43b2695ee763d18641b1eeea
|
|
| MD5 |
282fddd9db1fa2397bbfc28231e6da58
|
|
| BLAKE2b-256 |
4a2d7d3e148cb8e94a399bd7eec0a9df3bcf2a7116f1e359456feb185b0464ef
|
File details
Details for the file litestar_socketify-0.1.1-py3-none-any.whl.
File metadata
- Download URL: litestar_socketify-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edbe9ce2cb7230f36a1fc65e159a655010fe808dc33af1cf24d96a8012752e19
|
|
| MD5 |
3d6e4de4e1fb7a52d8230fa1e302cccb
|
|
| BLAKE2b-256 |
4481c95da29ff458f2ecc91bec1185c47f743332802ced5ff07ff8e67b6dca7c
|