A minimal, async-first Python web framework with ultra-low latency and low memory usage.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 xylen-1.2.1.tar.gz.
File metadata
- Download URL: xylen-1.2.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25bd4be52fd397f8fde2b5a19c3012c179de0c7e213f0f575eb49390ed3b756c
|
|
| MD5 |
64df928e483987c8d46c1dc4ce1bcb07
|
|
| BLAKE2b-256 |
d67dc8af61ab67fd6a7fd005eefc81ae24efce82cda2d5c890d0240ac68663f2
|
File details
Details for the file xylen-1.2.1-py3-none-any.whl.
File metadata
- Download URL: xylen-1.2.1-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52a4223538228346b6d9b1aeccb51c786217ad35fbb0190ffa936ce92df62494
|
|
| MD5 |
6ad0f62b5aec184f856015d50f408312
|
|
| BLAKE2b-256 |
3d9588205bd87c584e92675237470c62f731adac332fde36bc971ed27f700633
|