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.9.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.9.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.9.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.9.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.9.0.tar.gz (1.4 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.9.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded PyPymanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12+Windows x86-64

cello_framework-0.9.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.9.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.9.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.9.0.tar.gz.

File metadata

  • Download URL: cello_framework-0.9.0.tar.gz
  • Upload date:
  • Size: 1.4 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.9.0.tar.gz
Algorithm Hash digest
SHA256 9f8afa1be6d8278a0598fe9161f2a2f77e7320ac7496344ac180ba53d59fdd15
MD5 1adcb35d32d539c60cb01b3fae559f5d
BLAKE2b-256 b02d0178b74ad4738a08f854b8109e5f980c70ec9cc40550300dfc9e44b04d66

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bb7578371e11c0fbe54ecbf11361c2639aaca1b323dee41c3460c991ccff4c57
MD5 d2e64e8388f17ed6ebb37f40bf925467
BLAKE2b-256 9187ce9b81ca5a7c702b74cb49020f6f028bdc74fdeb3872a3cde80db7ed70fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 151eb15a2d13efdddbc2dd344d410c05ab0e31f0bbe0a1aa40e0379d5e290567
MD5 238fc8c8d5cfe55daedfee3af7433e8d
BLAKE2b-256 0d31bd363192530c73fa6ca5c7586f0d5ec8439df920f8268e327bd246895339

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d7ba5ccae4c95cd023abdc311892b6e3941050c7e8b4b052a395741541a98994
MD5 abc5e7007c923ea348ed9238e74e8478
BLAKE2b-256 c3a59d3f38237b82c8c3c2ab7020f67876ec70a3231490914f34661be941d87e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 552f3a239afa92bafdd501b9303e30eac86840c31fe2dff8fb62f56ebdfca66d
MD5 8d6e4d4a55cfaa3df209caac7957ea33
BLAKE2b-256 50d3f1bacf966261aef054c1d804d3c95639b0deef04a141694b2e1963edcad8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ee7f55adaa186e00a6f3099a55027a82574c7512c7627eb74626ef09d81883d3
MD5 8cfe9251b215f35db659025ff993b80c
BLAKE2b-256 0c6a6c825ba0ff25889585daac7e813c946d8dead77a9e10d324ccaf9bd9fcd8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f4038750b43737fdf4cfc9b24e93ed2952609342244870de887bb5c933ac6237
MD5 1db0c25ac8231916dd9753c439f7e7ea
BLAKE2b-256 5ed6d98701856ca10505c588c2f1ccb2d30662d8561a911cebba683cc6637b63

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5530787a2e753f1b94160ba5985b9329bdd1e5356ce6cf03503b3f638b84650
MD5 2ce17b5740d157198cf1b10ba3133ff2
BLAKE2b-256 dd14b1ff4cdb834b9a499685828d541504126dc441c9087fb2414e276c8e8d5c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.9.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c74902427b0657b03bf7ba7b9082bb8f86cf5bbe9638fc19b1ab27088ec325f2
MD5 c361f1b7f26cafc150d2fa96a9a95d60
BLAKE2b-256 2b02fb5e2e59a860d73f8bd10440bee243ea41522fe5042542f601dec43a8d89

See more details on using hashes here.

Provenance

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