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

API Protocol Features (v0.9.0)

Feature Description
🔷 GraphQL Query, Mutation, Subscription decorators with Schema builder
📊 DataLoader N+1 prevention with automatic batching and caching
🔌 gRPC Service-based gRPC with unary, streaming, and bidirectional support
📨 Kafka Consumer/producer decorators with automatic message routing
🐰 RabbitMQ AMQP messaging with topic exchanges and prefetch control
☁️ SQS/SNS AWS message queue integration with LocalStack 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.10.0"}

app.run()

API Protocol Features (v0.9.0)

from cello import App, GrpcConfig, KafkaConfig, RabbitMQConfig
from cello.graphql import Query, Mutation, Schema, DataLoader, GraphQL
from cello.grpc import GrpcService, grpc_method, GrpcServer
from cello.messaging import kafka_consumer, kafka_producer, Producer, Consumer

app = App()

# --- GraphQL ---
@Query
def users(info):
    return [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]

@Mutation
def create_user(info, name: str, email: str):
    return {"id": 3, "name": name, "email": email}

schema = Schema().query(users).mutation(create_user).build()

# --- gRPC ---
class UserService(GrpcService):
    @grpc_method
    async def get_user(self, request):
        return {"id": request.data.get("id"), "name": "Alice"}

app.enable_grpc(GrpcConfig(port=50051, reflection=True))
app.add_grpc_service("UserService", ["GetUser", "ListUsers"])

# --- Kafka ---
app.enable_messaging(KafkaConfig(brokers="localhost:9092", group_id="my-app"))

@kafka_consumer(topic="user-events", group="processors")
async def handle_user_event(message):
    print(f"Received: {message.text}")

@app.post("/users")
@kafka_producer(topic="user-events")
def create_user_api(request):
    return {"id": 1, "name": request.json().get("name")}

# --- RabbitMQ ---
app.enable_rabbitmq(RabbitMQConfig(url="amqp://localhost:5672"))

@app.get("/")
def home(request):
    return {"status": "ok", "version": "0.10.0", "protocols": ["graphql", "grpc", "kafka", "rabbitmq"]}

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.10.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
gRPC Custom Rust gRPC engine
GraphQL Python engine with Rust serialization
Messaging Kafka, RabbitMQ, SQS adapters

🔒 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: cello-framework.vercel.app


🤝 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.10.0.tar.gz (1.6 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.10.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cello_framework-0.10.0-cp312-abi3-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12+Windows x86-64

cello_framework-0.10.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.10.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

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

cello_framework-0.10.0-cp312-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: cello_framework-0.10.0.tar.gz
  • Upload date:
  • Size: 1.6 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.10.0.tar.gz
Algorithm Hash digest
SHA256 15e61fdfe022a7293b1cbf90ab23d1379a1d69471c45ffae2f26dc6e8312c77c
MD5 eb7e47ccf9c37745d48b2c7d39520de5
BLAKE2b-256 7a3957a8d89c3a566d9a91f7a386e04f612aeec5e00e43656d7fa91ef0c27a6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 af98a11edcc00fa6483eec0248e714cd8eecfd4f4d4d4e006c2dfc291f56443a
MD5 6d6d81f90e746ace97a5b02a761a61fb
BLAKE2b-256 9b227daa622b2716b3f53021e6d1f6006c7f7b7751f207758e0a9dc634042dca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fbae8075d6130e648b1799769f8b790eaf07330c010542773467ba1861a9e310
MD5 92779cf23b82705a21e7bf706cdce114
BLAKE2b-256 205df8f7246bb2714e649810567519bb53f5170755e3abb8cf6582fc79e44b62

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 07fdb05fca16de199a6b7bfbbf73687d141151b6c0c07c07e9e2a8105a88a171
MD5 e9ab9d2dd91a885b0069dd2a3d0da85f
BLAKE2b-256 11482938a84b1893e93e0d9fde43a8fef5fdb07b893242f3066fc9ff9c73c833

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 82e21f3675c02c7707fd53e7d6ce59bcf7a51c5878d287a03c35c0124951ecee
MD5 51247f104cfeff8a5fb0852b89985189
BLAKE2b-256 552d42d332ee991632bb530492aa3069c453d7a2bd9241ecc7b6c93fd5efa017

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 28a45324c0dd50e7d29cf68b425c32d6619853a9666bca78487014f6484e9c6c
MD5 3b271dfe7f17b6e35a06178cd796f35d
BLAKE2b-256 b0c8c4c3cd1b382d47a93c7b212a60e4498f3c329c55bd303584f37dafac6dc8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 08ae284860e1444e9cdbf583b9977e80c407e57e7d823c837915747e7301632a
MD5 fc2dce2e6086e62034719d2a31e226a1
BLAKE2b-256 b8902d8045df4b8218cb0a4378dfe2234659caf140098544c4f308f39cca8a77

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b5c023a70929c28f2b57d4336c5ce875027b09b45b5ffac1022383c8aa6215f
MD5 3b2c08bc8edb9bb2feec1d612fdf4bb0
BLAKE2b-256 bdc39662cf4ded68f40b424de9892966d7fe7557b48366ca35d2e96621910dc6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.10.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d14556b90db6c9184c130c4e4e0bb844a7a7b4cbf64dbbea92a01eff98e7de0d
MD5 329a8d62883acc5aa5070ab95a217e15
BLAKE2b-256 f67d41fbf5d8b0525a9706166d92e9fafad9a9290fc58d377e8256e85dfec8ba

See more details on using hashes here.

Provenance

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