mini-aiohttp
A small, dependency-free async HTTP/1.1 client and server built on Python's asyncio.
Features
- Async client with keep-alive connection pooling per host
- Async server with routing, keep-alive, and request body limits
- Connection cap: new connections get
503when the limit is reached, so memory stays bounded - Timeouts on requests and idle connections
- Chunked response parsing (client) and
Content-Lengthrequest bodies (server) - HTTPS on the client side
Install
pip install . # from source
pip install .[test] # with test dependencies
Quick start
import asyncio
from mini_aiohttp import Server, Response, ClientSession
app = Server(max_connections=100_000)
@app.route("/")
async def index(req):
return Response(200, "Hello")
@app.route("/echo", method="POST")
async def echo(req):
return Response.json({"got": req.json()})
async def main():
server = asyncio.create_task(app.serve_forever("127.0.0.1", 8080))
await asyncio.sleep(0.2)
async with ClientSession() as s:
r = await s.get("http://127.0.0.1:8080/")
print(r.status, r.body.decode())
server.cancel()
asyncio.run(main())
Running tests
pip install .[test]
pytest
Scaling to many connections
A single Python process can hold tens of thousands of idle keep-alive connections. Reaching 100k needs OS and deployment tuning:
- File descriptor limit. Each socket uses one. Raise it before starting:
ulimit -n 200000. The server logs a warning if the limit is too low. - Listen backlog. Raise the kernel queue:
sysctl -w net.core.somaxconn=65535. The server already requests a backlog of 4096. - Client-side ports. One client machine opening outbound connections to a single
ip:portis limited by ephemeral ports (about 28k to 64k). For more, spread load across several source IPs or client hosts. - Multiple processes. Python runs one event loop per process. Start several workers with
Server.start(..., reuse_port=True)on Linux to use all CPU cores. - Measure it. Test with a load tool such as
wrk,oha, orlocuston your own hardware before you rely on any number.
Limits (by design, v0.1)
- No HTTPS server (put a reverse proxy such as nginx in front).
- No chunked request bodies on the server.
- No HTTP/2 or WebSockets.
License
MIT
Metadata
Release files for mini-aiohttp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mini_aiohttp-0.1.2.tar.gz | 12.2 kB | With provenance | Details for mini_aiohttp-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mini_aiohttp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mini_aiohttp-0.1.2-py3-none-any.whl |
Total release size: 23.6 kB
Release files / mini_aiohttp-0.1.2.tar.gz
| Download URL | mini_aiohttp-0.1.2.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4243868de7351783b9626f02327c2fab9c309198d8c297af90c6645a0c16aeff
|
|
BLAKE2b-256 checksum How to use checksums |
4ac8538ae5f4f8b5f17aea18b44c134ef57809da7d48ddebfc3ffa6be1dc8494
|
| 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 16, 2026.
Transparency logRelease files / mini_aiohttp-0.1.2-py3-none-any.whl
| Download URL | mini_aiohttp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc9e0b0401736fdeaa8c488589103c8c204989d42b7d51ab818f185c3cf4ebb2
|
|
BLAKE2b-256 checksum How to use checksums |
9560dc310b62d5fb25b8cdeb98d2200c9900472b3027583a2089b73d98846b7f
|
| 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 16, 2026.
Transparency logSecurity for mini-aiohttp 0.1.2
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
Both files in this release have been uploaded with provenance metadata.
Attestation for mini_aiohttp-0.1.2.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 16, 2026.
Transparency logA 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.