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

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

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.7.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.7.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.7.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.7.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.7.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.7.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12+Windows x86-64

cello_framework-0.7.0-cp312-abi3-manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

cello_framework-0.7.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.7.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.7.0.tar.gz.

File metadata

  • Download URL: cello_framework-0.7.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.7.0.tar.gz
Algorithm Hash digest
SHA256 45a9b7bb8521ff4832f3a13bc86bed8449f69bc1de58deb833a5202734159022
MD5 3de3ae6c080df98a21182a6461837c76
BLAKE2b-256 01541b43a957038b88ebb47196a76b37af6a00aeef652e1f3e2b2858303b894d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c21078a5bdf64acd9768d202107d934d83787b1311660fe055ec55933a533a5f
MD5 69f9c9cb8e51b76177d08d183df54221
BLAKE2b-256 97d63998a936c8c9bc14ab1af3cf9b06eee769c86b9086d63eef4c7676d551a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 67eefa70c00a63481c651160c4bf119add0dde63dee658c5f075d3c6a4e31e5f
MD5 36b4e608d83c75a5e70298afcecca14c
BLAKE2b-256 ac9d60edb8f175c69601ec97880e436e253398d9d62817e842c75c2cce2f93a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e139432c0410d028f91778797c83a43c2db4409f4f98fb9bb2c6a09c00667cb3
MD5 3e47a5702bd152bdd8ef421a1282844c
BLAKE2b-256 2e1d8d1e973c76d32020d94b461e976e9937143a27e9afdfb16a6863e3a77f2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b47627ae48b0e10158860c35b447c37ee9e11f9e93c6ab411d3e3964087022fa
MD5 11f5383a80234d956dfa3fe6b94ce061
BLAKE2b-256 ce2171fac39d700a9036eedf9494ab1ed7321306d641dd4cf126ea0eb67aee71

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 38ffe741ac5428189b1f44247c5421a609fdc586c2ac06a8b0ea78a9c350a393
MD5 4df2561854fcbc75684633abf2911f52
BLAKE2b-256 01a90aee074f67f416c1a6176882c044bd1db6424440dd07e7b7ec59e2c20443

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 466e48ef2421922ac2d33d7ff088b38615abef763198f8c52cfb3d965ec0d593
MD5 b455ba443e93d11c8e85437fb4978327
BLAKE2b-256 dc1ffc5264f08f8de63933b94631aaa62d9df376cc5bfed2310662fb42626825

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1370223fec1e5c6c210171f3d123b673cd3ade7669396dbd95d447f155f4fe8
MD5 4c69329910dcadc30b35e78c3c446d39
BLAKE2b-256 7bb748569e97a2c2226eca168e5cc7a9c46bb2c8884d0da83036aee4f0d1af7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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.7.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cello_framework-0.7.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5c520a230e4b002f8735b6a9f969bfab6988d9f637c1fcc9f3d77f0f3ab742b
MD5 eaa507a685c5849c6e3654288857012a
BLAKE2b-256 6673b187ddb9ebad9a9812ad878514fac6de62b23cdd6a02743d2684f355c556

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.7.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