Skip to main content

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:

🧪 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

xylen-1.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xylen-1.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file xylen-1.1.0.tar.gz.

File metadata

  • Download URL: xylen-1.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for xylen-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bc6e510307e165505d5c7def0273fadd38581ad36529b4c7cacea2f09380b10f
MD5 23bd75d53242d97956d4b964f164b909
BLAKE2b-256 9e0e8d4e39aef7bf9037d672211142b90d8083bea0b8eff843dafff49836bc93

See more details on using hashes here.

File details

Details for the file xylen-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: xylen-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for xylen-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dbc0f3af33991450df3338c35c2b17d15f08d98f72a4b622b28fc77da801ebc
MD5 285a895b74b5d5c890ee0771d4ad863e
BLAKE2b-256 2785445d822fa4c4bf45aa110e7f89d8cf203fd0f00afdcb0aa58e6206a4562e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page