Skip to main content

Oxi Logo

🚀 OxiServer: The Polyglot Python Web Engine

Write Python once. Deploy it anywhere. At full speed.

OxiServer is a high-performance, polyglot web ecosystem for serving Python applications. It allows you to ship the exact same OxiApp codebase to a 1.45 GB/sec C++ engine, a fast Julia engine, or a pure Python fallback — with zero code changes.

It's not just another ASGI framework. It's a unified server that serves static assets at wire speed, runs CGI and PHP natively, hosts ASGI/WSGI apps, and speaks the ASGI Lifespan protocol flawlessly across three different runtimes.


🌍 The Oxi Ecosystem

Most frameworks lock you into a single runtime. Oxi doesn't. You write your app using standard ASGI/WSGI, and choose your engine at deploy time:

Engine Language Python Mode Static Speed Best For
server C++ Embedded (in-process) 1.45 GB/sec (sendfile) Production, maximum performance
server.jl Julia Subprocess (Unix socket IPC) Near-C speed REPL-driven dev, scientific apps
server.py Python Standalone Pure Python Portability, zero dependencies

All three engines:

  • ✅ Speak ASGI 3.0 and WSGI.
  • ✅ Serve static assets and directory listings.
  • ✅ Execute CGI and PHP out of the box.
  • ✅ Support the ASGI Lifespan protocol.
  • ✅ Run OxiApp, Starlette, FastAPI, Flask, or Django.

⚡ Quickstart

1. Installation

The standard installation gives you the complete OxiServer Python suite:

  • The OxiApp framework (app.py).
  • The Python ASGI/WSGI server (server.py).
  • The Julia ASGI/WSGI server (server.jl).
  • The C++ source code (src/, Makefile), ready to be compiled for maximum performance.
# Standard install (pure Python asyncio)
pip install oxi

# High-performance install (adds uvloop for faster asyncio)
pip install "oxi[uvloop]"

🚀 Enabling the C++ Engine (Optional)
To achieve maximum throughput (over 1.4 GB/sec for static assets), you need to compile the bundled C++ engine. If you have a C++23-compatible compiler installed, this takes just a few seconds:
# Compile the C++ binary
oxibuild

# If you need to remove the binary (e.g., to uninstall cleanly)
oxibuild clean

🚀 Upon install, you can get an immediate feel of what Oxi can do, both the server and the app part, by running:
rundemo

🚀 Or, you can scaffold a new ASGI by running:
scaffolding my_blog [--with-demo]
cd my_blog 

# Eventually, cloning the repo is another option.
git clone https://github.com/sandy98/oxi.git
cd oxi
make

🌍 Run the same app on any engine

Command Result
oxiserver apps.demo:app Runs C++ (if compiled), else Python
oxiserver apps.demo:app --julia Runs Julia engine
oxiserver apps.demo:app --python Runs Python engine (even if C++ exists)
oxiserver --help Shows C++ or Python help (depending on which is active)

⚙️ Features

The C++ Engine (server)

  • Zero-copy static serving via sendfile().
  • Embedded CPython 3.10 +: C++ handles the sockets and HTTP parsing, while Python handles the ASGI/WSGI logic.
  • True Lifespan : App on_startup hooks block C++ socket binding until they complete. App on_shutdown hooks are guaranteed to fire on Ctrl+C.
  • Process Isolation : CGI scripts spawn in their own process groups with strict timeout and memory boundaries.

The Framework (OxiApp)

Built on top of the battle-tested TinA framework (Tiny Asynchronous).

  • Flask-like routing : @app.get("/"), @app.post("/").
  • Built-in Sessions & Templating .
  • App Mounting : app.mount(flask_app, "/admin") seamlessly integrates WSGI apps inside your ASGI app.
  • Full Lifespan Decorators :

from oxi.app import OxiApp

app = OxiApp("My API")

@app.on_startup async def connect_db(): print("🚀 Connecting to database...")

@app.get("/") async def index(): return "Hello from OxiApp!"

CGI & PHP (Out of the box)

Drop a .py, .sh, .pl, .rb, .java, or .php file into static/cgi-bin/. OxiServer detects it, spawns the interpreter safely, and parses the CGI Status: headers natively.

  • No mod_cgi configuration.
  • No php-fpm setup.

📺 Native Video Streaming

OxiServer is fully RFC 7233 compliant. It supports HTTP Range requests natively in C++, enabling seamless video seeking and streaming in browsers, VLC, and native media players without dropping connections or exhausting memory.


📊 Benchmarks

Tested on Linux x86_64, serving a 676 KB JPEG file with wrk -t4 -c100 -d30s:

Engine Requests/sec Transfer/sec Notes
OxiServer (C++) 2,298 req/s 1.45 GB/sec Thread-per-connection +sendfile
Nginx (Reference) ~2,400 req/s ~1.55 GB/sec Epoll event loop
Apache (mod_php) ~800 req/s ~500 MB/sec Process-per-request

Note: The C++ engine remains fully responsive to new connections even while under 100% load, and shuts down cleanly in < 50ms without dropping active requests.

🏗️ Architecture (Under the Hood)

OxiServer is a three-tier system. When a request arrives:

  1. C++ Fast Path : Checks if the request is a static file or a CGI script. If so, it handles it entirely in C++ using sendfile or posix_spawn().
  2. Python Offload : If the request is dynamic (an ASGI/WSGI route), C++ hands the raw socket file descriptor to the embedded CPython event loop via asyncio.
  3. Zero-Copy Bridge : The Python app reads/writes directly to the socket, completely bypassing the C++ HTTP layer once the handoff is complete.

This hybrid approach means you get the raw network speed of C++ for static files, and the ecosystem of Python for dynamic logic.

🛠️ Configuration

Customize OxiServer in __about__.py:

config = { "static_dir": "static", "cgi_dir": "cgi-bin", "index_files": ["index.html", "index.htm", "index.php"], "allow_dirlisting": True, "allow_cgi": True, "max_body_size": 10 * 1024 * 1024, # 10 MB limit for CGI requests }


🗺️ Roadmap

  • **☑ **C++ Engine with Lifespan & CGI
  • **☑ **Julia Engine with Unix Socket IPC
  • **☑ **Python Standalone Engine
  • **☑ **ASGI 3.0 & WebSockets
  • **☑ **WSGI Adapter (Flask/Django support)
  • **□ **HTTP/2 support (coming soon)
  • **□ **Multi-worker mode for C++
  • **□ **Prometheus metrics endpoint

License

MIT License. See LICENSE for details.

OxiServer is the evolution of the TinA framework. To the original TinA users: thank you for the years of production reliability. Welcome to Oxi.


Metadata

Release files for oxi 1.3.21

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

Source distribution (sdist)

Source distribution for oxi 1.3.21
File Size Uploaded Provenance Actions
oxi-1.3.21.tar.gz 4.3 MB Without provenance Details for oxi-1.3.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oxi 1.3.21
File Interpreter ABI Platform Actions
oxi-1.3.21-py3-none-any.whl Python 3 none any Details for oxi-1.3.21-py3-none-any.whl

Total release size: 8.7 MB

Release files / oxi-1.3.21.tar.gz

Download URL oxi-1.3.21.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
7b0654b7a166627f4305f24c1e4a86f81f9ce6abba26971085a0e1f8453276f0
BLAKE2b-256 checksum
How to use checksums
c7d3dd81eabd6159c3c5516293cec356866997b17667a7925e897e72290d0c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.0rc1

Release files / oxi-1.3.21-py3-none-any.whl

Download URL oxi-1.3.21-py3-none-any.whl
Size 4.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
72ece3ae2a83daa55399faa93c9304bc51531ba4b7130716c5bd7b4238f1f9a7
BLAKE2b-256 checksum
How to use checksums
e60750afff664a4d28f2b02e634413b479452ca127f6bdf5dbbd0767f88e3689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.0rc1

Security for oxi 1.3.21

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.3.21 This release

2 release files No provenance

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