A tonio-powered fork of uvicorn.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toncorn-0.49.0.1.tar.gz.
File metadata
- Download URL: toncorn-0.49.0.1.tar.gz
- Upload date:
- Size: 60.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb628c997988d44cb70681c1d3092668ff73bb0dc2ddd6e51e0b557cd13fed7f
|
|
| MD5 |
00c72e2bbd65a52af932b5d5617c5502
|
|
| BLAKE2b-256 |
5baea682821a17434a222fadd5ab0c5e2cb468785b42623f42c66408b77fb8b2
|
Provenance
The following attestation bundles were made for toncorn-0.49.0.1.tar.gz:
Publisher:
publish.yml on gi0baro/toncorn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toncorn-0.49.0.1.tar.gz -
Subject digest:
cb628c997988d44cb70681c1d3092668ff73bb0dc2ddd6e51e0b557cd13fed7f - Sigstore transparency entry: 1954578636
- Sigstore integration time:
-
Permalink:
gi0baro/toncorn@5e771da5014faebddece1feead8de6c7c17ad9bd -
Branch / Tag:
refs/tags/v0.49.0.1 - Owner: https://github.com/gi0baro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e771da5014faebddece1feead8de6c7c17ad9bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file toncorn-0.49.0.1-py3-none-any.whl.
File metadata
- Download URL: toncorn-0.49.0.1-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
858c24d8a75542cf18beed7de6b2d724f6df746b8640e52724838ac5476f7272
|
|
| MD5 |
6c56b59fd3e2289050c2ffdceda6b9d0
|
|
| BLAKE2b-256 |
5e928432d2740aaf0778f8daffc45d30bf587fdfbb640c4f63ef1e047a0b4484
|
Provenance
The following attestation bundles were made for toncorn-0.49.0.1-py3-none-any.whl:
Publisher:
publish.yml on gi0baro/toncorn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toncorn-0.49.0.1-py3-none-any.whl -
Subject digest:
858c24d8a75542cf18beed7de6b2d724f6df746b8640e52724838ac5476f7272 - Sigstore transparency entry: 1954578757
- Sigstore integration time:
-
Permalink:
gi0baro/toncorn@5e771da5014faebddece1feead8de6c7c17ad9bd -
Branch / Tag:
refs/tags/v0.49.0.1 - Owner: https://github.com/gi0baro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5e771da5014faebddece1feead8de6c7c17ad9bd -
Trigger Event:
release
-
Statement type: