Palfrey
Palfrey is a clean-room, high-performance Python ASGI server with source-traceable parity mapping.
Documentation: https://palfrey.dymmond.com 📚
Source Code: https://github.com/dymmond/palfrey
The official supported version is always the latest released.
Palfrey is a clean-room ASGI server focused on three things:
- behavior you can reason about
- deployment controls you can operate safely
- performance you can reproduce and verify
Protocol runtime modes include HTTP/1.1 backends plus opt-in HTTP/2 (--http h2) and HTTP/3 (--http h3) paths.
Palfrey vs Uvicorn
Palfrey was built with deep respect for Uvicorn and the ASGI ecosystem it helped mature. This is not a "winner vs loser" comparison. Uvicorn is an excellent, battle-tested server, and Palfrey intentionally keeps a compatible API/CLI experience so teams coming from Uvicorn feel at home. Our goal is to offer another strong option when teams want different internal architecture and extended runtime capabilities.
Benchmark snapshot (HTTP sample):
- Command:
hatch run python benchmarks/run.py --http-requests 100000 --http-concurrency 50 --ws-clients 0 --ws-messages 0 --samples 5
| Scenario | Palfrey Ops/s | Uvicorn Ops/s | Relative Speed |
|---|---|---|---|
| HTTP | 35016.18 | 33154.69 | 1.056x |
These numbers are environment-dependent. Always benchmark with your own app, traffic profile, and infrastructure before making production decisions.
This documentation is written for both technical and non-technical readers.
- Engineers can use the protocol details, option tables, and runbooks.
- Product, support, and operations teams can use the plain-language summaries and checklists.
What Palfrey Does
At runtime, Palfrey sits between clients and your ASGI application.
- accepts TCP or UNIX socket connections
- parses protocol bytes into ASGI events
- calls your app with
scope,receive,send - writes responses back to clients
- manages process behavior (reload, workers, graceful shutdown)
Who Should Start Where
If you are new to ASGI
If you operate production services
First 60 Seconds
Create main.py:
async def app(scope, receive, send):
"""Return a plain-text greeting for HTTP requests."""
if scope["type"] != "http":
return
body = b"Hello from Palfrey"
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [
(b"content-type", b"text/plain; charset=utf-8"),
(b"content-length", str(len(body)).encode("ascii")),
],
}
)
await send({"type": "http.response.body", "body": body})
Run Palfrey:
palfrey main:app --host 127.0.0.1 --port 8000
Check it:
curl http://127.0.0.1:8000
Gunicorn + Palfrey worker:
gunicorn main:app -k palfrey.workers.PalfreyWorker -w 4 -b 0.0.0.0:8000
Documentation Structure
Getting Started
- install, verify, and run your first app
- move from a minimal app to real startup patterns
Concepts
- what ASGI is, and how Palfrey applies it
- how HTTP, WebSocket, and lifespan flows behave
- how server internals affect user-visible outcomes
Reference
- full CLI and config surface
- protocol and logging behavior
- env var model and common errors
Guides
- migration, security hardening, production rollout
- practical troubleshooting and FAQ
Operations
- deployment shapes, workers, reload model
- capacity planning, observability, benchmark method
- platform-specific notes and release process
Plain-Language Summary
If your application is the business logic, Palfrey is the runtime control layer around it. A good runtime control layer gives teams:
- predictable startup and shutdown
- fewer surprises under traffic spikes
- clearer incident response paths
- safer, repeatable deployments
Metadata
Release files for palfrey 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| palfrey-0.2.0.tar.gz | 276.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| palfrey-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 405.2 kB
Release files / palfrey-0.2.0.tar.gz
| Download URL | palfrey-0.2.0.tar.gz |
|---|---|
| Size | 276.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf747ef0eeef1cd985e77745f61a68595ce358775bc83cfab99b617188f31f9f
|
|
BLAKE2b-256 checksum How to use checksums |
1d3f283d0dd78767829ef3fb5e23bb3fd7ddb100c0dd3ac03090ce34d992afaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.4 cpython/3.10.20 HTTPX/0.28.1
|
Release files / palfrey-0.2.0-py3-none-any.whl
| Download URL | palfrey-0.2.0-py3-none-any.whl |
|---|---|
| Size | 128.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d26b6935224cb9a561a503bf4f1d8eb94e910269342226700b6c7915bb19dfa7
|
|
BLAKE2b-256 checksum How to use checksums |
e5401b1961c383505267d47b0d46a56103cafce43943d6ffa16b2b0e9b593c59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.4 cpython/3.10.20 HTTPX/0.28.1
|