toncorn
An ASGI web server for free-threaded Python, powered by tonio.
toncorn is a fork of uvicorn that swaps the asyncio runtime for tonio.
Install
$ pip install toncorn
toncorn requires free-threaded CPython 3.14 or newer (python3.14t) and runs PYTHON_GIL=0.
Linux and macOS only; Windows is not supported and won't be (tonio doesn't target it).
For the optional protocol/parser extras (matching upstream uvicorn's [standard] set):
$ pip install 'toncorn[standard]'
Quickstart
example.py:
async def app(scope, receive, send):
assert scope["type"] == "http"
await send({
"type": "http.response.start",
"status": 200,
"headers": [(b"content-type", b"text/plain")],
})
await send({
"type": "http.response.body",
"body": b"Hello, world!",
})
Run it:
$ PYTHON_GIL=0 toncorn example:app
You'll see a banner identifying the toncorn version and the uvicorn version it tracks:
INFO: toncorn 0.48.0.0 (uvicorn 0.48.0)
INFO: Started server process [12345]
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
The package ships both import toncorn and import uvicorn — the source tree
lives under the original uvicorn package name to keep the diff against
upstream small, and toncorn is a thin re-export. Pick whichever import you
prefer; they expose the same Config, Server, run, main.
Note: this means
toncornand the real PyPIuvicorncollide on theuvicornimport name; don't install both in the same environment.
Programmatic use
import toncorn
toncorn.run("example:app", host="127.0.0.1", port=8000)
Or with an explicit Config + Server:
import toncorn
config = toncorn.Config(app=app, host="127.0.0.1", port=8000)
server = toncorn.Server(config)
server.run()
Differences from uvicorn
- Runtime is tonio, not asyncio. There's no
--loopflag, nouvloop/asyncioswitch. Everything runs on a single tonio runtime with a configurable thread pool. - Concurrency model is threads, not processes. The old
--workers Nflag is replaced by--threads N, which sizes the tonio scheduler's thread pool. Nomultiprocessingsupervisor, no preforked workers, no graceful-restart process orchestration. - No
--reload. The auto-reload supervisor is gone. Use your editor's hot-reload or a separate process manager during development. - No Windows support. POSIX only.
- No in-tree WSGI middleware. The deprecated WSGI bridge has been removed;
use
a2wsgiorasgiref.wsgiif you need WSGI compatibility. - Python 3.14+ only. Earlier Python versions are not supported.
The version number reflects both upstream and fork: {uvicorn}.{toncorn}, so
0.48.0.0 tracks uvicorn 0.48.0 with toncorn patch 0. Patch-level
releases against the same uvicorn baseline bump the last segment
(0.48.0.0 → 0.48.0.1).
Upstream tracking
The source tree under uvicorn/ is kept as close to upstream uvicorn as
possible to make merges/rebases tractable. Fork-specific changes are
intentionally minimal and called out where they appear. The toncorn/ package
is a re-export shim plus the toncorn-specific version.
License
BSD-3-Clause, same as upstream uvicorn. See LICENSE.md.
Metadata
Release files for toncorn 0.51.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| toncorn-0.51.0.1.tar.gz | 62.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toncorn-0.51.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.2 kB
Release files / toncorn-0.51.0.1.tar.gz
| Download URL | toncorn-0.51.0.1.tar.gz |
|---|---|
| Size | 62.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daef1d7f9e9af8e0015fa9a428a27cabd9db7acf3e54e95b5dbfcc8e0e13761f
|
|
BLAKE2b-256 checksum How to use checksums |
616fdae637c2e16eb2f544a6136ce999f9da04a898889341a5425c8ccc670d5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 16, 2026.
Transparency logRelease files / toncorn-0.51.0.1-py3-none-any.whl
| Download URL | toncorn-0.51.0.1-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fa83c04ef3aa37ae41871e609a9f232606364f0fe4f4b49a01b2b2f025c8639
|
|
BLAKE2b-256 checksum How to use checksums |
9188ad6ac82de716a32e11b10f1839c195576513bc79494ddc170805546b7933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 16, 2026.
Transparency log