A minimal, stable ASGI foundation - framework-agnostic toolkit for building high-performance web services
Project description
Genro ASGI
A minimal, stable ASGI foundation - framework-agnostic toolkit for building high-performance web services.
Overview
Genro ASGI provides a minimal, production-ready ASGI server and application toolkit built on top of genro-routes for routing. It offers essential components for building web services with full type safety.
Key Features
- Minimal Core: Essential components only, no bloat
- Router Integration: Uses
genro-routesfor flexible, decorator-based routing - MCP Support: Built-in MCP Streamable HTTP transport via
McpApplication - Production-Ready: Tested, typed, and stable
- Type-Safe: Full type hints throughout
- Essential Components:
- ASGI server with config-driven application mounting
- HTTP request/response utilities
- Lifespan management
- Middleware (authentication, CORS, errors, compression, cache, logging)
- Static file serving via
StaticRouter - WebSocket support with WSX extension protocol
- Filesystem storage with mount system
Installation
# Basic installation
pip install genro-asgi
# With fast JSON support
pip install genro-asgi[json]
# Development installation
pip install genro-asgi[dev]
# Documentation build
pip install genro-asgi[docs]
Quick Start
CLI - Serve static files
# Create config.yaml
cat > config.yaml << EOF
server:
host: "127.0.0.1"
port: 8000
apps:
static:
module: "genro_asgi:StaticRouter"
directory: "./public"
index: "index.html"
EOF
# Run server
python -m genro_asgi serve .
Python - Custom server
from genro_asgi import AsgiServer
server = AsgiServer(server_dir=".")
server.run() # Starts uvicorn
Architecture
Genro ASGI is designed around these principles:
- Instance Isolation: Server and apps are isolated instances, not global functions
- Composability: Mix and match components as needed
- Type Safety: Full type hints throughout
- Dual Parent-Child: Child objects hold a semantic reference to their parent
Core Components
- AsgiServer: ASGI entry point, loads config, mounts apps
- AsgiApplication: Base class for mountable applications
- McpApplication: MCP Streamable HTTP transport
- HttpRequest: HTTP request wrapper with headers, query, body
- Response: HTTP response with auto content-type detection
- Lifespan / ServerLifespan: Startup/shutdown event management
- Dispatcher: Request routing and dispatch
- StaticRouter: Filesystem-backed static file serving
- LocalStorage: Filesystem storage with mount system
Middleware
- AuthMiddleware: O(1) authentication (bearer, basic, JWT)
- CORSMiddleware: Cross-Origin Resource Sharing headers
- ErrorMiddleware: Exception handling and error responses
- CompressionMiddleware: Gzip response compression
- CacheMiddleware: HTTP response caching
- LoggingMiddleware: Request/response logging
Documentation
Full documentation available at: https://genro-asgi.readthedocs.io
Development
Setup
# Clone repository
git clone https://github.com/genropy/genro-asgi.git
cd genro-asgi
# Install in development mode
pip install -e .[dev]
Testing
# Run tests
pytest
# With coverage
pytest --cov=genro_asgi --cov-report=html
Code Quality
# Lint code
ruff check .
# Type check
mypy src
License
This project is licensed under the Apache License 2.0.
Copyright © 2025-2026 Softwell S.r.l.
You may obtain a copy of the license at:
https://www.apache.org/licenses/LICENSE-2.0
This project may include third-party components distributed under separate open-source licenses.
See the NOTICE file for additional attribution.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Links
- GitHub: https://github.com/genropy/genro-asgi
- PyPI: https://pypi.org/project/genro-asgi/
- Documentation: https://genro-asgi.readthedocs.io
- Issue Tracker: https://github.com/genropy/genro-asgi/issues
Credits
Developed by Softwell S.r.l.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genro_asgi-0.2.0.tar.gz.
File metadata
- Download URL: genro_asgi-0.2.0.tar.gz
- Upload date:
- Size: 118.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39095685cd0b4319af81d2a06fe9497a2c8858f04c8ffae66f59089e2fe415a0
|
|
| MD5 |
997736118d1628e4d91d140c67b63b6d
|
|
| BLAKE2b-256 |
afa472e5648e25529096491af79c6e3c39bda357ee5c48f8ba27eb74a4c67097
|
Provenance
The following attestation bundles were made for genro_asgi-0.2.0.tar.gz:
Publisher:
publish.yml on genropy/genro-asgi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genro_asgi-0.2.0.tar.gz -
Subject digest:
39095685cd0b4319af81d2a06fe9497a2c8858f04c8ffae66f59089e2fe415a0 - Sigstore transparency entry: 1180668091
- Sigstore integration time:
-
Permalink:
genropy/genro-asgi@6dd84f17a85b3f07b0993972a3c2c47f26f3c403 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/genropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6dd84f17a85b3f07b0993972a3c2c47f26f3c403 -
Trigger Event:
release
-
Statement type:
File details
Details for the file genro_asgi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: genro_asgi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 120.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf15be712ac4a9175198849a43c82ae52667d4c5fba2b8c317c1fc1099a641d
|
|
| MD5 |
4c5eb8f5484d849ea9dbe2489da1f352
|
|
| BLAKE2b-256 |
7dd7eed332d26b998986dcf38be8ed02c9a298b51a9ec9b99132834e8195f844
|
Provenance
The following attestation bundles were made for genro_asgi-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on genropy/genro-asgi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genro_asgi-0.2.0-py3-none-any.whl -
Subject digest:
dcf15be712ac4a9175198849a43c82ae52667d4c5fba2b8c317c1fc1099a641d - Sigstore transparency entry: 1180668175
- Sigstore integration time:
-
Permalink:
genropy/genro-asgi@6dd84f17a85b3f07b0993972a3c2c47f26f3c403 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/genropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6dd84f17a85b3f07b0993972a3c2c47f26f3c403 -
Trigger Event:
release
-
Statement type: