Skip to main content

Ultra-fast Rust-powered Python async web framework

Project description

Cello 🐍

CI PyPI Python License

Ultra-fast Rust-powered Python async web framework

Cello is a high-performance web framework that combines Python's developer experience with Rust's raw speed. All HTTP handling, routing, and JSON serialization happen in Rust—Python handles only your business logic.

✨ Features

Feature Description
🚀 Blazing Fast Tokio + Hyper HTTP engine in pure Rust
📦 SIMD JSON SIMD-accelerated JSON with simd-json
🛡️ Middleware Built-in CORS, logging, gzip compression
🗺️ Blueprints Flask-like route grouping
🌐 WebSocket Real-time bidirectional communication
📡 SSE Server-Sent Events streaming
📁 File Uploads Multipart form data handling
🐍 Pythonic Decorator-based routing like Flask

📦 Installation

pip install cello-framework

From source:

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

🚀 Quick Start

from cello import App, Response

app = App()

# Enable middleware
app.enable_cors()
app.enable_logging()
app.enable_compression()

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

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

@app.post("/users")
def create_user(request):
    data = request.json()
    return {"id": 1, "name": data["name"]}

if __name__ == "__main__":
    app.run()

🛠️ CLI & Configuration

Cello comes with built-in CLI argument parsing. You can configure the server using command-line arguments without changing your code.

Development Mode (Hot Reload + Debug Logs)

python main.py --env development --reload

Production Mode (Fast + No Debug Logs)

python main.py --env production --no-logs --workers 8 --port 8080

Available Options

Argument Default Description
--host 127.0.0.1 Host to bind to
--port 8000 Port to bind to
--env development Environment (development or production)
--reload False Enable hot reloading (restarts on file change)
--workers CPU Count Number of worker threads
--debug Auto Enable debug logs (default True in dev)
--no-logs False Disable all request logging
# You can also set defaults in code
app.run(
    host="0.0.0.0", 
    port=5000, 
    env="production", 
    workers=4
)

📖 Documentation

Blueprints

Group routes with shared prefixes:

from cello import App, Blueprint

api = Blueprint("/api/v1")

@api.get("/users")
def list_users(request):
    return {"users": []}

@api.get("/users/{id}")
def get_user(request):
    return {"id": request.params["id"]}

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

Request Object

def handler(request):
    request.method              # "GET", "POST", etc.
    request.path                # "/users/123"
    request.params["id"]        # Path parameters
    request.query["search"]     # Query parameters
    request.get_header("auth")  # Headers
    request.body()              # Raw bytes
    request.text()              # String body
    request.json()              # Parsed JSON
    request.form()              # Form data dict

Response Types

from cello import Response

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

# Custom responses
return Response.json({"ok": True}, status=201)
return Response.text("Hello!")
return Response.html("<h1>Hello</h1>")
return Response.file("/path/to/file.pdf")
return Response.redirect("/new-url")
return Response.no_content()

Middleware

app = App()

# CORS - allow cross-origin requests
app.enable_cors()
app.enable_cors(origins=["https://example.com"])

# Logging - log all requests
app.enable_logging()

# Compression - gzip responses
app.enable_compression()
app.enable_compression(min_size=1024)

WebSocket

@app.websocket("/ws")
def websocket_handler(ws):
    ws.send_text("Welcome!")
    while True:
        msg = ws.recv()
        if msg is None:
            break
        ws.send_text(f"Echo: {msg.text}")

Server-Sent Events

from cello import SseEvent, SseStream

@app.get("/events")
def events(request):
    stream = SseStream()
    stream.add_data("Hello")
    stream.add_event("update", '{"count": 1}')
    return stream

🏗️ Architecture

Request → Rust HTTP Engine → Python Handler → Rust Response
              │                    │
              ├─ SIMD JSON         ├─ Return dict
              ├─ Radix routing     └─ Return Response
              └─ Middleware

🛠️ Development

# Setup
python -m venv .venv
source .venv/bin/activate
pip install maturin pytest ruff

# Build & Test
maturin develop
pytest tests/ -v

# Lint
ruff check python/ tests/
cargo clippy

📊 Tech Stack

Component Technology
HTTP Server Tokio + Hyper
JSON simd-json + serde
Routing matchit (radix tree)
Python Bindings PyO3
Compression flate2 (gzip)

📄 License

MIT License - see LICENSE

👤 Author

Jagadeesh Katla

cello

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.2.2.tar.gz (54.3 kB 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.2.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (822.1 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

cello_framework-0.2.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (822.1 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

cello_framework-0.2.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (822.9 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

cello_framework-0.2.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (824.1 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

cello_framework-0.2.2-cp312-abi3-win_amd64.whl (708.2 kB view details)

Uploaded CPython 3.12+Windows x86-64

cello_framework-0.2.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (818.9 kB view details)

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

cello_framework-0.2.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (821.5 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

cello_framework-0.2.2-cp312-abi3-macosx_11_0_arm64.whl (745.0 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for cello_framework-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d012b421434b2abdfe1d65da303b1e1d8e08709c4e70aa03c3db135099b5fd25
MD5 14ce283f05be206e71e160139c3598ce
BLAKE2b-256 a38d945a573462c5030b77b53a70e27eca3b2537e0cb06c78c124c40a19e5c7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2.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.2.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5fef330affc906a03fcb46add59a8620618000e559df555aa388b52b043257a1
MD5 8f669c3f45155bba389c4070cfaa9c75
BLAKE2b-256 38a19f864df8b2d7c8b33aa5c2200c162c9115f111f8c3b5605c9c36a50a74a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_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.2.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b07546e9ed92f30bacac7364590f20b1cf9db0832b9cb3ca16d08730415880d2
MD5 488003e7c55ae07c631e0c30c6978b96
BLAKE2b-256 5ff39e04f04e12c3bca205ffa63c18310df691df4717e183fc4f36e0ef8607d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_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.2.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cd5133c10a998ec22de5fc8e6d8581b70c8e2dbb92541d36d8e022c4e7682c31
MD5 55e7e466a48ceef1fc98dbe0b1280cf1
BLAKE2b-256 db1a223a6c1c757d0e64109b4057fa6291af7a8b3a9c5247b8f3b040b443fffc

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_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.2.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a1210dbc8055458cc768f0adc02f3324abe8bca918a588aa2432e850c8315fe4
MD5 bea2cf9deda548fba3d669fcd5999b5f
BLAKE2b-256 481d72a8b50d2c134fedd855f681a3247fc98c3bd2a88545749464a630849b03

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_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.2.2-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bf83568028dbc81f1af0efb21e3ce3e1108017b80455ba3c15d77c19cb284fc1
MD5 0351458d788161d6d41f0051b293ae2d
BLAKE2b-256 27312e0f75f59a6554cfdb6c6662f29fa75b64f77025364c7c9e88abbaa469d4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cello_framework-0.2.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f26c2133bb8b0a9e85c29c7027161b812dedff4d94686c8c27621f448198fd7
MD5 3551f825eb0b902e7468da2cbf993269
BLAKE2b-256 e07c315eed6bd9eaf69955a5fe07ffb6a6c9a23238229e03965fece31f36af90

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-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.2.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c9800ee92157d2c4f23a59b62f125eef01d01361dcb3197380d550308ead97bb
MD5 867eb52356e26d25fc9dcfb65c4a02a1
BLAKE2b-256 f2f121ec91e0fcda2f6156f4a8d561352218bc6a222136e2cfb7f051a7709d86

See more details on using hashes here.

Provenance

The following attestation bundles were made for cello_framework-0.2.2-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_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.2.2-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cello_framework-0.2.2-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 037ed56d6d560db8cfddf324da13a7e0a52f939ed6569649f9a77860960e9b8b
MD5 7b4eb9222081dc22bbe1c4e3b7e554f7
BLAKE2b-256 38db1e812e303a047f4d2dfd8c31229e9f8d53815179f9d693be72b0c4481841

See more details on using hashes here.

Provenance

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