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.1.tar.gz (12.2 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.1-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xylen-1.1.1.tar.gz
  • Upload date:
  • Size: 12.2 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.1.tar.gz
Algorithm Hash digest
SHA256 fd1fa1ab7055b28262726389a4853f8d6c44d38cc394eec3d0d752009055596b
MD5 6d8cbd78f2135a66e031e5ab30e7ed4b
BLAKE2b-256 57942251c86536922fcbccd9ccd4abaddd2acd8929046e73549358e92fe2555f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xylen-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 823a610a9301c705cc2cc071cbdcda429d34b4b18cb915b34a700379a2ccd077
MD5 47ad0fbfb4c29361b583d78428322b28
BLAKE2b-256 8a25f2450500d08da87ce9aa6c63c65e2abcf63948f8497b3244112c63ba95f6

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