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.2.0.tar.gz (13.1 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.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xylen-1.2.0.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

Hashes for xylen-1.2.0.tar.gz
Algorithm Hash digest
SHA256 20d6f448baa06119d97434366c1edd850cbc9dc35f41ade71f343047e7650972
MD5 a019db928e829a411e1c5fa5392e1aea
BLAKE2b-256 d63ca440f4483910a8bdb356e5371e2443dc656bd9e58ec254e1215b2abf566c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xylen-1.2.0-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

Hashes for xylen-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd654d923e3ea9e26eb619423a7f2ce4b72789c5a6dad9d44a938f0c59696bc2
MD5 f2fcee3752bba160b3c32336f79d1407
BLAKE2b-256 55d95f420c8e11959979042e02f42e4a0c920c24ba96a7021ea130ea0e7c45c1

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