Skip to main content

Ultra-fast Rust-powered Python async web framework

Project description

Cello

The World's Fastest Python Web Framework
Rust-powered performance with Python simplicity

CI PyPI Python License

InstallationQuick StartFeaturesExamplesDocumentation


Why Cello?

Cello is an enterprise-grade Python web framework that combines Python's developer experience with Rust's raw performance. All HTTP handling, routing, JSON serialization, and middleware execute in native Rust while Python handles your business logic.

┌─────────────────────────────────────────────────────────────────┐
│  Request → Rust HTTP Engine → Python Handler → Rust Response   │
│                  │                    │                         │
│                  ├─ SIMD JSON         ├─ Return dict            │
│                  ├─ Radix routing     └─ Return Response        │
│                  └─ Middleware (Rust)                           │
└─────────────────────────────────────────────────────────────────┘

📦 Installation

pip install cello-framework

From source:

git clone https://github.com/jagadeesh32/cello.git
cd cello
pip install maturin
maturin develop

Requirements: Python 3.12+


🚀 Quick Start

from cello import App, Response

app = App()

@app.get("/")
def home(request):
    return {"message": "Hello, Cello! 🎸"}

@app.get("/users/{id}")
def get_user(request):
    return {"id": request.params["id"], "name": "John Doe"}

@app.post("/users")
def create_user(request):
    data = request.json()
    return Response.json({"id": 1, **data}, status=201)

if __name__ == "__main__":
    app.run()
python app.py
# 🐍 Cello v0.8.0 server starting at http://127.0.0.1:8000

✨ Features

Core Features

Feature Description
🚀 Blazing Fast Tokio + Hyper async HTTP engine in pure Rust
📦 SIMD JSON SIMD-accelerated JSON parsing with simd-json
🛤️ Radix Routing Ultra-fast route matching with matchit
🔄 Async/Sync Support for both async def and regular def handlers
🛡️ Middleware Built-in CORS, logging, compression, rate limiting
📐 Blueprints Flask-like route grouping and modular apps
🌐 WebSocket Real-time bidirectional communication
📡 SSE Server-Sent Events for streaming
📁 Multipart File uploads and form data handling

Security Features

Feature Description
🔐 JWT Authentication JSON Web Token with constant-time validation
🛡️ CSRF Protection Double-submit cookie and signed token patterns
⏱️ Rate Limiting Token bucket, sliding window, and adaptive algorithms
🍪 Sessions Secure cookie-based session management
🔒 Security Headers CSP, HSTS, X-Frame-Options, Referrer-Policy
🔑 API Key Auth Header and query parameter authentication

Enterprise Features (v0.7.0+)

Feature Description
📊 OpenTelemetry Distributed tracing with W3C Trace Context
🏥 Health Checks Kubernetes-compatible liveness/readiness probes
🗄️ Database Pooling Connection pool management with metrics
🔷 GraphQL GraphQL endpoint with Playground UI
💉 Dependency Injection Type-safe DI with Singleton/Request/Transient scopes
🛡️ Guards (RBAC) Role & permission-based access control
📈 Prometheus Metrics Production-ready metrics at /metrics
🔌 Circuit Breaker Fault tolerance with automatic recovery

Data Layer Features (v0.8.0)

Feature Description
🗄️ Enhanced DB Pooling Async connection pool with health monitoring & reconnection
🔴 Redis Integration Async Redis client with pool, Pub/Sub, cluster mode
🔄 Transactions Automatic transaction management with decorator support

Protocol Support

Feature Description
🔒 TLS/SSL Native HTTPS with rustls
HTTP/2 Multiplexed connections with h2
🚀 HTTP/3 QUIC protocol support with quinn
🏭 Cluster Mode Multi-worker process deployment

📘 Examples

Data Layer Features (v0.8.0)

from cello import App, DatabaseConfig, RedisConfig
from cello.database import transactional

app = App()

# Enable database connection pooling
app.enable_database(DatabaseConfig(
    url="postgresql://user:pass@localhost/mydb",
    pool_size=20,
    max_lifetime_secs=1800
))

# Enable Redis connection
app.enable_redis(RedisConfig(
    url="redis://localhost:6379",
    pool_size=10
))

@app.post("/transfer")
@transactional
async def transfer(request):
    # Automatic transaction management
    return {"success": True}

@app.get("/")
def home(request):
    return {"status": "ok", "version": "0.8.0"}

app.run()

Enterprise Features (v0.7.0+)

from cello import App, OpenTelemetryConfig, HealthCheckConfig, GraphQLConfig

app = App()

# Enable distributed tracing
app.enable_telemetry(OpenTelemetryConfig(
    service_name="my-api",
    otlp_endpoint="http://collector:4317",
    sampling_rate=0.1
))

# Enable Kubernetes health checks
app.enable_health_checks(HealthCheckConfig(
    base_path="/health",
    include_details=True,
    include_system_info=True
))

# Enable GraphQL with Playground
app.enable_graphql(GraphQLConfig(
    path="/graphql",
    playground=True,
    introspection=True
))

# Enable Prometheus metrics
app.enable_prometheus(endpoint="/metrics")

@app.get("/")
def home(request):
    return {"status": "ok", "version": "0.8.0"}

app.run()

Blueprints (Route Grouping)

from cello import App, Blueprint

api_v1 = Blueprint("/api/v1")

@api_v1.get("/users")
def list_users(request):
    return {"users": [{"id": 1, "name": "Alice"}]}

@api_v1.post("/users")
def create_user(request):
    return Response.json(request.json(), status=201)

app = App()
app.register_blueprint(api_v1)
app.run()

Guards (RBAC)

from cello import App, RateLimitConfig

app = App()

# Role-based access control
@app.add_guard
def require_auth(request):
    return request.headers.get("Authorization") is not None

@app.add_guard
def require_admin(request):
    token = request.headers.get("Authorization", "")
    return "admin" in token

# Rate limiting
app.enable_rate_limit(RateLimitConfig.token_bucket(
    capacity=100,
    refill_rate=10
))

@app.get("/admin")
def admin_panel(request):
    return {"message": "Welcome, Admin!"}

WebSocket

@app.websocket("/ws/chat")
def chat_handler(ws):
    ws.send_text("Welcome to the chat!")

    while True:
        message = ws.recv()
        if message is None:
            break
        ws.send_json({"type": "echo", "content": message.text})

Server-Sent Events

from cello import SseStream

@app.get("/events")
def event_stream(request):
    stream = SseStream()
    stream.add_event("update", '{"count": 42}')
    stream.add_event("notification", '{"message": "New data"}')
    return stream

Response Types

from cello import Response

# JSON (default)
return {"data": "value"}

# Explicit JSON with status
return Response.json({"created": True}, status=201)

# Other response types
return Response.text("Hello, World!")
return Response.html("<h1>Welcome</h1>")
return Response.file("/path/to/document.pdf")
return Response.redirect("/new-location")
return Response.no_content()

🏗️ Tech Stack

Component Technology
Runtime Tokio (async Rust)
HTTP Server Hyper 1.x
JSON simd-json + serde
Routing matchit (radix tree)
Python Bindings PyO3
TLS/SSL rustls
HTTP/2 h2
HTTP/3 quinn (QUIC)
Tracing OpenTelemetry
Metrics Prometheus
JWT jsonwebtoken

🔒 Security

Cello is built with security as a priority:

  • Constant-time comparison for passwords, API keys, and tokens
  • CSRF protection with double-submit cookies and signed tokens
  • Security headers (CSP, HSTS, X-Frame-Options, Referrer-Policy)
  • Rate limiting with multiple algorithms
  • Session security (Secure, HttpOnly, SameSite cookies)
  • Path traversal protection in static file serving
  • JWT blacklisting for token revocation

🛠️ Development

# Setup
git clone https://github.com/jagadeesh32/cello.git
cd cello
python -m venv .venv
source .venv/bin/activate
pip install maturin pytest

# Build
maturin develop

# Test
pytest tests/ -v

# Lint
cargo clippy
cargo fmt

📚 Documentation

Full documentation available at: jagadeesh32.github.io/cello


🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.


📄 License

MIT License - see LICENSE


👤 Author

Jagadeesh Katla - @jagadeesh32


Made with ❤️ using 🐍 Python and 🦀 Rust

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

cello_framework-0.8.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cello_framework-0.8.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.8.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.8.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.8.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.8.0-cp312-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12+Windows x86-64

cello_framework-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

cello_framework-0.8.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

cello_framework-0.8.0-cp312-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file cello_framework-0.8.0.tar.gz.

File metadata

  • Download URL: cello_framework-0.8.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cello_framework-0.8.0.tar.gz
Algorithm Hash digest
SHA256 9bd8a2a43fcc66dc8d014cc5b38f16a8854671a0b8474816fed0ee7e15fecc02
MD5 99b5cb8e1208165f8d44c3a3f347fe67
BLAKE2b-256 9bc9a6b00b6ded71c0175292024934d1af955f614336c185750160042bcd5a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0.tar.gz:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6254a911a6f71a6e34db314ebddd2e35687ad6ad23e01ef561556248107803aa
MD5 8f1ad43a69c9a4105990723b24589b89
BLAKE2b-256 c066115c85878a69961fca52c999cf3060a2835052d69e8313b0e0922b33f4e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b9b9eba540138c04b3f82674eb19507c708e8f72009b309de961bf7a61cf5fb9
MD5 134ca4e5f0087390ba17e29225fb8680
BLAKE2b-256 a507940b73f5a64aeac0dcc43f1b0c27b966b28e42bb2cb298493007856cbb3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 60766d301bd5629e2cb3839d4c74a5ea0a3ac6af6b34d8425399a4f873a3999a
MD5 4e5188289efef6e17f83f475a6b6f43a
BLAKE2b-256 a50e3cf631d826c6fbd233e626dea9b74f89842f473065bb1e8f6f5c0466ca38

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d9c2183bf75f252716b7c44b07fa9dd45805db53b913ac4e9105f53edfaf9238
MD5 971fd9ab8bd9a565c71f37e1f04691fc
BLAKE2b-256 fd89639e43247a5f7c7614d7bbeac46733d351af2fc764898f0f86874a49d8b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a5fdceb3837c72c6074083a2472b6def5f26bd4ae1233732ad0523c4f5366683
MD5 bb2eeb51d0bd10a209316b14201cf503
BLAKE2b-256 5fa2eb71bbaf458d19412ac80edc6153dbcf14ff74e4d1488a4a1350b2f39196

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-cp312-abi3-win_amd64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 987ff21ea54a1d4239a0096d2d68164c9619c954606efb28763eacea92d7b9ba
MD5 292f38cee56af6661bc60fc2753301a3
BLAKE2b-256 c74bc75eb25847c3df3f4f649ef4f99085cce8b69eca21173c547a846fc09b1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 054404a3674e82f5597daeff2987efe66620b5c587e43b6936b41b4b2c327ab2
MD5 d280c3c8b885303d537b690442bf0dff
BLAKE2b-256 49de679885b29271ee16522757a0e7bbed1ac89522ffe9a7b34bdcc576bc56ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cello_framework-0.8.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cello_framework-0.8.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 622e8b68af3d059d8e6bb86b4fbfdca69db781b48461b5db3951bfd2582db3ef
MD5 5774662e526dbe5e6b4020dafc21a216
BLAKE2b-256 1518610324e4752a4821667e0fc6df6d928a2db272e5ad12da6df3d8ffc779e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.8.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on jagadeesh32/cello

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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