Routly
A lightweight, modular, modern Python microframework for Web & REST APIs.
Overview
Routly is crafted for developers who desire the simplicity and elegance of modern microframeworks combined with enterprise-grade security and production WSGI reliability. It provides first-class REST API primitives, automatic content negotiation, double-submit CSRF defense, signed cookie sessions, and an interactive Tailwind CSS dark-mode debugger.
Key Features
- Expressive & Typed Routing: Compiled regex path matching with typed converters (
/users/{id:int},float,slug,uuid,path), multi-method routes, per-router/routedependencies=[...], and modularRouter(prefix=...)mounting viainclude_router. - Built-In CLI (
routly): Scaffold projects (routly create), run an auto-reloading dev server (routly runserver --reload), inspect routes (routly routes), open an interactive REPL (routly shell), and generate secret keys (routly secretkey). - First-Class REST APIs & Streaming: Native serialization for Python dictionaries and lists to
application/json, HTTP status tuples ({"ok": True}, 201), plus chunkedStreamingResponseandFileResponsewith MIME detection. - Dual-Mode Access Decorators: Protect routes via
@login_required,@require_role,@require_permissions,@require_api_key,@require_https, or@rate_limitas decorators or router guards. - Standard HTTP Verbs: Intuitive decorators (
@app.get,@app.post,@app.put,@app.patch,@app.delete,@app.route). - Lifecycle & Custom Error Handling: Thread-safe
@app.on_startup/@app.on_shutdownhooks and@app.error_handler(...)for status codes or exception classes. - Modular Middleware Onion:
SecurityMiddleware: Domain whitelisting (ALLOWED_HOSTS), clickjacking defense (X-Frame-Options), MIME-sniffing prevention, and HSTS.CsrfMiddleware: Double-submit cookie defense for state-changing HTTP methods.SessionMiddleware: Tamper-proof, HMAC-SHA256 cryptographically signed cookies or server-side Redis sessions (SESSION_STORE).CorsMiddleware: Cross-Origin Resource Sharing with customizable origins and preflight handling.GZipMiddleware: On-the-fly response payload compression (automatically skipping streaming responses).ProcessTimeMiddleware: High-precision latency diagnostics inX-Process-Time.LoggingMiddleware: Single-line structured console access logs with ANSI status colors and client IP tracking.RateLimitMiddleware: Thread-safe sliding-window rate limiting with429 TooManyRequests,Retry-Afterheaders, and optional shared Redis backend (RATE_LIMIT_STORE).
- Intelligent Content Negotiation: API endpoints receive clean JSON errors, while browser clients get an interactive developer error screen.
- Tailwind Dark-Mode Debugger: Visual traceback inspection with one-click clipboard copying and client headers display.
- Integrated Templating & Media Uploads: Jinja2 rendering with
{{ static(...) }},{{ media(...) }}, and{{ csrf_input() }}helpers, plusrequest.files(UploadedFile) uploads and dynamicMEDIA_ROOTdelivery. - Built-in Static Delivery: Seamless asset serving powered by WhiteNoise.
- WSGI Standard: Deploy directly on Gunicorn, uWSGI, Granian, or Waitress.
Installation
pip install routly
Or install with optional Redis store support or development dependencies:
pip install "routly[redis]"
pip install "routly[dev]"
Example Project
A complete, production-grade example application featuring authentication, session management, CSRF protection, and REST API CRUD is available in the example/ directory.
To run the showcase application locally:
python example/main.py
Testing
Use the built-in routly.testing.TestClient for in-process endpoint testing with persistent cookies, JSON helpers, and redirect following, and run the test suite with pytest:
pytest tests/
License
Created by Abdulbosit Alijonov.
Distributed under the MIT License.
Metadata
Release files for routly 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| routly-0.4.0.tar.gz | 71.2 kB | Without provenance | Details for routly-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| routly-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for routly-0.4.0-py3-none-any.whl |
Total release size: 130.5 kB
Release files / routly-0.4.0.tar.gz
| Download URL | routly-0.4.0.tar.gz |
|---|---|
| Size | 71.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e941110ffcd2c801b0cc21a92caf6a1f01a65d38eda5ac07cccec3b8c04215b1
|
|
BLAKE2b-256 checksum How to use checksums |
d77cf21347c942f335d15945faf24b2de19968a0787d6b3165e4f7672fbc746e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / routly-0.4.0-py3-none-any.whl
| Download URL | routly-0.4.0-py3-none-any.whl |
|---|---|
| Size | 59.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c3656e46111794119c27054f2e8e11ab7b9a09874c7160aa6ea36c619b4f7f0
|
|
BLAKE2b-256 checksum How to use checksums |
ef5c14265dbe77d7dd7eda48ffdef0e161150739d850b9808ce6396f97d1575c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for routly 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.