Skip to main content

🦄 Tsuno

High-performance WSGI/ASGI server powered by Rust

Python Version License Development Status

Tsuno aims to be a drop-in replacement for Gunicorn and Uvicorn with a Rust-powered transport layer. Run your Django, Flask, FastAPI, Starlette, and connect-python applications with HTTP/2 support.

Installation

pip install tsuno

Quick Start

Command Line

tsuno myapp:app --workers 4 --bind 0.0.0.0:8000

Python API

Flask (WSGI):

from flask import Flask
from tsuno import run

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World"

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

FastAPI (ASGI):

from fastapi import FastAPI
from tsuno import run

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}

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

See examples/ for complete working examples.

What Makes Tsuno Different

  • Mixed Protocol Serving: Serve WSGI and ASGI apps simultaneously on the same server (example)
  • High Performance: Powered by Tokio and hyper
  • API Compatibility: Aims for complete compatibility with both Gunicorn and Uvicorn APIs
  • Unix Domain Sockets: Full UDS support for nginx integration (example)

Examples

Complete working examples in the examples/ directory:

Example Description
wsgi_flask_app.py Flask WSGI application
asgi_fastapi_app.py FastAPI ASGI application
mixed_wsgi_asgi.py Mixed WSGI + ASGI serving (unique to Tsuno!)
wsgi_multi_app.py Multiple Flask apps on different paths
asgi_multi_app.py Multiple FastAPI apps on different paths
uds_example.py Unix Domain Socket server
lifespan_test.py ASGI Lifespan events demo
tsuno.toml TOML configuration example

Configuration

Command Line

# Basic
tsuno myapp:app --bind 0.0.0.0:8000 --workers 4

# With auto-reload (development)
tsuno myapp:app --reload

# With Unix domain socket
tsuno myapp:app --uds /tmp/tsuno.sock

# With configuration file
tsuno myapp:app -c tsuno.toml

Configuration File

Python format (Gunicorn-compatible):

# tsuno.conf.py
bind = "0.0.0.0:8000"
workers = 4
threads = 2
log_level = "info"

TOML format:

# tsuno.toml
bind = "0.0.0.0:8000"
workers = 4
threads = 2
log_level = "info"

See examples/tsuno.toml for all options.

Python API

from tsuno import run

run(
    app,
    host="0.0.0.0",
    port=8000,
    workers=4,
    reload=True,  # Development only
)

Production Features

Worker Management

  • Auto-restart crashed workers
  • Graceful shutdown and reload
  • Worker timeout monitoring
  • Max requests per worker (memory leak prevention)

Graceful Reload (Zero-Downtime)

# Start with PID file
tsuno myapp:app --pid /var/run/tsuno.pid

# Graceful reload (no downtime)
kill -HUP $(cat /var/run/tsuno.pid)

Logging

  • Structured logging (text/JSON)
  • Access log support
  • Customizable log formats

Performance

Performance varies by workload, platform, and configuration. Run wrk or h2load benchmarks to measure performance on your specific hardware.

Migration

From Gunicorn

# Before
gunicorn myapp:app --workers 4 --bind 0.0.0.0:8000

# After (same syntax!)
tsuno myapp:app --workers 4 --bind 0.0.0.0:8000

From Uvicorn

# Before
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000, workers=4)

# After (compatible API!)
import tsuno
tsuno.run(app, host="0.0.0.0", port=8000, workers=4)

Development Status

Tsuno is in early development (alpha stage).

  • ⚠️ Real-world production testing needed

Help us test! Report issues at github.com/i2y/tsuno/issues

Requirements

  • Python 3.11-3.14
  • Rust toolchain (for building from source)

Platform Support

  • macOS: Fully supported
  • Linux: Fully supported
  • Windows: Not tested yet

Known Limitations

Project Status: Alpha - production testing needed

Not Implemented Yet:

  • SSL/TLS support
  • CLI daemon mode (Python API supports it via daemon=True)
  • Custom worker_connections limits
  • Error log file redirection

Contributing

Contributions are welcome! Please:

  • Report issues at github.com/i2y/tsuno/issues
  • Submit pull requests for bug fixes or new features
  • Help improve documentation and examples

License

MIT License - see LICENSE

Acknowledgments

Tsuno is inspired by and builds upon excellent work from:

  • Gunicorn & Uvicorn: Server standards
  • Granian: Rust-Python hybrid architecture
  • Tokio, hyper, PyO3: Rust ecosystem

Metadata

Release files for tsuno 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsuno 0.1.4
File Size Uploaded Provenance Actions
tsuno-0.1.4.tar.gz 61.4 kB With provenance Details for tsuno-0.1.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tsuno 0.1.4
File Interpreter ABI Platform Actions
tsuno-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for tsuno-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl
tsuno-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for tsuno-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl
tsuno-0.1.4-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for tsuno-0.1.4-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 3.4 MB

Release files / tsuno-0.1.4.tar.gz

Download URL tsuno-0.1.4.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e5031e126ebf8636bd166a4c34ff6a17a1b9a4f3377d531b04d6c2ac84a72308
BLAKE2b-256 checksum
How to use checksums
9f4da7d910554368b017f0e1f4d4a8609635cde271ef2b0d33538a0b344735f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / tsuno-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL tsuno-0.1.4-cp311-abi3-manylinux_2_28_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
297b6720e3c0c76ba5386b61505b95eaf77805798da625e975debbe420622a1f
BLAKE2b-256 checksum
How to use checksums
8c63209e48595349bbfe9371f15d27a0610200b88e0ead7eabfab931ed1f924a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / tsuno-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL tsuno-0.1.4-cp311-abi3-manylinux_2_28_aarch64.whl
Size 1.1 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
3bcc90af9394e2be9ae8d81cd33492f7dfc7b58347464ea6782d8f485f59b35e
BLAKE2b-256 checksum
How to use checksums
a085084fdcc2e02846af4db5aa82692a0614b02e126956d72567f7997fd1a1b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / tsuno-0.1.4-cp311-abi3-macosx_11_0_arm64.whl

Download URL tsuno-0.1.4-cp311-abi3-macosx_11_0_arm64.whl
Size 1.0 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bb196d96a0036f670cdfb0222ebe18d9837c7c8e5345798d703b1c9e9ad566b4
BLAKE2b-256 checksum
How to use checksums
195532da3f39a33e69eea30b029864c4eca3e32f659509ec77c81257289451c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for tsuno 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for tsuno-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page