Xylen
A minimal, async-first Python web framework with ultra-low latency and low memory usage.
✨ Features
- Async-first with ASGI native support
- Ultra-low latency and minimal RAM usage
- Smart routing with type-safe path parameters (
/user/{id:int}) - Built-in CORS, CSRF, and rate-limiting middleware
- Automatic OpenAPI/Swagger UI (no Pydantic required)
- Dedicated CLI:
xylen run --app myapp:app --reload - Full test client for unit testing
- Zero required dependencies — pure Python
🚀 Quick Start
pip install xylen
Create app.py:
from xylen import Xylen
app = Xylen(
cors=True,
rate_limit=True,
rate_limit_config={"max_requests": 100, "window_seconds": 60}
)
@app.openapi(
path="/hello",
methods=["GET"],
summary="Say hello",
responses={200: {"description": "A greeting message"}}
)
async def hello(request):
return {"message": "Hello from Xylen!"}
@app.openapi(
path="/user/{user_id:int}",
methods=["GET"],
summary="Get user by ID"
)
def get_user(request, user_id: int):
return {"user_id": user_id}
Run with auto-reload:
xylen run --app app:app --reload --port 8000
Visit:
- http://127.0.0.1:8000/hello
- http://127.0.0.1:8000/docs → Interactive API docs
🧪 Testing
from app import app
from xylen import TestClient
def test_hello():
client = TestClient(app)
resp = client.get("/hello")
assert resp.status_code == 200
assert resp.json()["message"] == "Hello from Xylen!"
Run tests:
pip install -e ".[dev]"
pytest
📦 Middleware
Enable built-in security and control:
app = Xylen(
cors=True,
csrf=True,
rate_limit=True,
rate_limit_config={"max_requests": 10, "window_seconds": 60}
)
📄 License
MIT © Parham Fakhari
Xylen: Lightweight as the wind, fast as lightning.
Release files for xylen 1.2.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 | |
|---|---|---|---|
| xylen-1.2.1.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xylen-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.8 kB
Release files / xylen-1.2.1.tar.gz
| Download URL | xylen-1.2.1.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25bd4be52fd397f8fde2b5a19c3012c179de0c7e213f0f575eb49390ed3b756c
|
|
BLAKE2b-256 checksum How to use checksums |
d67dc8af61ab67fd6a7fd005eefc81ae24efce82cda2d5c890d0240ac68663f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / xylen-1.2.1-py3-none-any.whl
| Download URL | xylen-1.2.1-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52a4223538228346b6d9b1aeccb51c786217ad35fbb0190ffa936ce92df62494
|
|
BLAKE2b-256 checksum How to use checksums |
3d9588205bd87c584e92675237470c62f731adac332fde36bc971ed27f700633
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|