Metadata-Version: 2.4
Name: xylen
Version: 1.1.1
Summary: A minimal, async-first Python web framework with ultra-low latency and low memory usage.
Author-email: Parham Fakhar <parhamfakhari.nab2020@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Parhamfakhar1/xylen
Project-URL: Repository, https://github.com/Parhamfakhar1/xylen
Project-URL: Documentation, https://github.com/Parhamfakhar1/xylen#readme
Project-URL: Changelog, https://github.com/Parhamfakhar1/xylen/releases
Keywords: web,async,asgi,framework,fast,lightweight,openapi,swagger
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: uvicorn>=0.20.0; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: watchfiles>=0.20.0; extra == "dev"
Requires-Dist: httpx>=0.25.0; extra == "dev"
Dynamic: license-file

# 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

```bash
pip install xylen
```

Create `app.py`:

```python
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:

```bash
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

```python
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:

```bash
pip install -e ".[dev]"
pytest
```

## 📦 Middleware

Enable built-in security and control:

```python
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.
