Skip to main content

pyferrum

PyPI version Python versions License: MIT CI

A Python web framework with a Rust HTTP runtime. Define routes and application behavior in Python; pyferrum uses Tokio and Hyper for its server, router, and selected request/response fast paths.

Version 1.0.0 establishes the first stable public API. pyferrum is not an ASGI/WSGI server and is not a drop-in replacement for FastAPI, Flask, or Django. See the comparison and current limitations below before choosing it.

Install

pyferrum supports CPython 3.10 and newer. Its abi3 extension targets CPython 3.8, while CI tests every supported minor version from 3.10 through 3.15. PyPy is not a supported runtime.

Releases provide prebuilt wheels for Linux and Windows, but not macOS. On macOS, pip builds the extension from source, so install Rust with Cargo and the Xcode Command Line Tools first (xcode-select --install).

python -m pip install pyferrum

Quick start

Save this as app.py:

from pyferrum import Ferrum, JsonResponse, Request

app = Ferrum()


@app.get("/")
async def index(request: Request):
    return {"hello": "world"}


@app.get("/users/{user_id}")
def get_user(request: Request):
    return {"id": int(request.path_params["user_id"])}


@app.post("/echo")
async def echo(request: Request):
    return JsonResponse({"echoed": request.json()})


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8080)

Run the app and make a request:

python app.py
curl http://127.0.0.1:8080/
curl -X POST http://127.0.0.1:8080/echo \
  -H 'Content-Type: application/json' \
  -d '{"message":"hello"}'

The pyferrum CLI can run an importable app and optionally watch project Python, Rust, and TOML files:

pyferrum run app:app --dev --debug --host 127.0.0.1 --port 8080

Development mode prints a reload notice when watched files change, before revalidating the project and restarting the server.

--debug enables detailed server logging by setting RUST_LOG=debug; it does not return Python tracebacks to clients. Otherwise, RUST_LOG controls runtime log levels. The application details are printed on startup; the listening banner is an info-level log. Access logging is enabled by --debug or app.run(request_logging=True) and records the response status, method, path (without query string), and request ID. Levels are INFO for 1xx/2xx, DEBUG for 3xx, WARN for 4xx, and ERROR for 5xx; nonstandard 6xx-9xx statuses are WARN. RUST_LOG filters these levels, so 3xx logs require debug logging. For streaming responses, the logged status is the initial response status, not the outcome of transmitting the entire body. See pyferrum run --help for the supported options.

What is included

  • Tokio/Hyper HTTP server and a matchit router with path parameters and 404/405 handling.
  • Synchronous and asynchronous Python handlers. Async handlers share one process-level asyncio event loop; Python handler concurrency is bounded.
  • Rust JSON parsing/serialization for supported Python containers, plus Request, Response, and helpers for JSON, text, HTML, XML, CSV, file downloads, redirects, and server-sent events.
  • Async Python response streaming from bytes/text chunks. Request bodies are buffered, with a 10 MiB engine default.
  • Request/body/connection/shutdown timeouts, header count and size limits, request IDs, configurable security headers, optional fixed-window per-client-IP rate limiting, CORS origin/method/header controls, and an in-flight request cap.
  • Optional PEM-based TLS, trusted-proxy forwarding, gzip for eligible buffered responses, and a small Prometheus-format /metrics endpoint.
  • TOML route tables and Rust-only built-in health, static-file, and redirect routes.
  • Optional Rust native route plugins. Plugins run synchronously in-process, are not sandboxed, and must be trusted.
  • A pyferrum command-line runner and optional worker subprocesses on platforms supporting SO_REUSEPORT.

The defaults include a 100-handler Python concurrency limit, a 1,000-request process limit, enabled security headers and gzip, and disabled rate limiting. See ARCHITECTURE.md for request flow, options, and limits. For the complete Python API, route/response helpers, and server option reference, see API.md.

Comparison

These projects solve related but different problems. This table compares their documented roles, not benchmark results.

Project Main role Application interface Important distinction
pyferrum Rust HTTP runtime with Python route handlers pyferrum decorators and request/response types Does not currently host ASGI/WSGI apps or provide built-in OpenAPI, request-model validation, or a broad extension ecosystem.
FastAPI Python ASGI web framework ASGI, type hints, dependency injection Includes an established validation and OpenAPI workflow and integrates with ASGI servers such as Uvicorn.
Flask Python WSGI web framework WSGI and Flask extensions Offers a mature, flexible Python framework and extension ecosystem.
Uvicorn / Hypercorn ASGI servers ASGI application objects These are servers rather than direct equivalents to a routing framework; they commonly run FastAPI or Starlette apps.

Choose pyferrum when you want its Rust-backed server and direct Python decorator API, and its narrower ecosystem meets your needs. Choose FastAPI, Flask, or Django when their compatibility, validation, middleware, or ecosystem is a requirement. There are no performance numbers or universal speedup claims in this README.

Current limitations

The 1.0.0 API baseline does not imply feature parity with larger frameworks. In particular, pyferrum does not currently include:

  • ASGI/WSGI hosting or compatibility adapters.
  • Built-in authentication/authorization or CSRF middleware, or an ORM.
  • OpenAPI generation or built-in schema-based request validation.
  • WebSockets or streaming request-body APIs.
  • HTTP/3; explicit HTTP/2 TLS ALPN behavior and integration coverage remain roadmap work.

Rate limiting is disabled unless configured. TLS is optional and uses certificate/key files supplied by the application; there is no automatic certificate provisioning or client-certificate authentication. Security headers and resource limits are safeguards, not substitutes for application authentication, authorization, input validation, or deployment controls. Native plugins execute with the server process's privileges.

Examples and documentation

License

pyferrum is open-source software licensed under the MIT License.

Contributing and security

Contributions are welcome; start with CONTRIBUTING.md. Please report vulnerabilities privately as described in SECURITY.md, not in a public issue.

Publishing

Maintainers publish releases through the GitHub Actions workflow using PyPI Trusted Publishing. The workflow and required publisher configuration are in .github/workflows/release.yml.

Metadata

Release files for pyferrum 1.0.0

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

Source distribution (sdist)

Source distribution for pyferrum 1.0.0
File Size Uploaded Provenance Actions
pyferrum-1.0.0.tar.gz 87.2 kB With provenance Details for pyferrum-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyferrum 1.0.0
File Actions
pyferrum-1.0.0-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details for pyferrum-1.0.0-cp38-abi3-win_arm64.whl
pyferrum-1.0.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for pyferrum-1.0.0-cp38-abi3-win_amd64.whl
pyferrum-1.0.0-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details for pyferrum-1.0.0-cp38-abi3-musllinux_1_2_x86_64.whl
pyferrum-1.0.0-cp38-abi3-manylinux_2_28_x86_64.whl CPython 3.8 abi3 Linux glibc 2.28+ x86-64 Details for pyferrum-1.0.0-cp38-abi3-manylinux_2_28_x86_64.whl
pyferrum-1.0.0-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details for pyferrum-1.0.0-cp38-abi3-manylinux_2_28_aarch64.whl

Total release size: 11.8 MB

Release files / pyferrum-1.0.0.tar.gz

Download URL pyferrum-1.0.0.tar.gz
Size 87.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2c347dea8f48687d1f351a841cc704a4688f62483a7d62673c3ef88083bf2a15
BLAKE2b-256 checksum
How to use checksums
ddf35a6382775dd7a38d57bea3e91a1ee2e5cd3fb33faff5e5af1cf5eb3e877c
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 27, 2026.

Transparency log

Release files / pyferrum-1.0.0-cp38-abi3-win_arm64.whl

Download URL pyferrum-1.0.0-cp38-abi3-win_arm64.whl
Size 2.1 MB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
9948d3834a6553a200e1f112b55ae301327a59b4c1dff0b3665ed7bdf584cc06
BLAKE2b-256 checksum
How to use checksums
1588fc7ad33b49af848b744063831cd3765ba302f023d3e8527d81c6eef05568
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 27, 2026.

Transparency log

Release files / pyferrum-1.0.0-cp38-abi3-win_amd64.whl

Download URL pyferrum-1.0.0-cp38-abi3-win_amd64.whl
Size 2.1 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8e54e37217549afbbbd88ffcc8d7ba2048a9102954a1b4ebc5e91580d965705b
BLAKE2b-256 checksum
How to use checksums
572d005285d187e0ec99997f2227fe60ecd998f752303268f085aff3a13d3299
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 27, 2026.

Transparency log

Release files / pyferrum-1.0.0-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL pyferrum-1.0.0-cp38-abi3-musllinux_1_2_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
c4885802f3dac2fc9eec5e9674071b529f7522f5471edad8043fe897be4c1c8f
BLAKE2b-256 checksum
How to use checksums
bc63850dd397dd7fcf351d59f0c7982f05e2bd3e80ef48359fa625626a8cdfd3
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 27, 2026.

Transparency log

Release files / pyferrum-1.0.0-cp38-abi3-manylinux_2_28_x86_64.whl

Download URL pyferrum-1.0.0-cp38-abi3-manylinux_2_28_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6a58b2da9980d0cc5b6a7fe9d71cb6457c91205453a3c0b9a7d7a7dff374c174
BLAKE2b-256 checksum
How to use checksums
8c607a25a656bb871e800fd6f4c3b6dab68088cd5b5e445df35c3669dc646961
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 27, 2026.

Transparency log

Release files / pyferrum-1.0.0-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL pyferrum-1.0.0-cp38-abi3-manylinux_2_28_aarch64.whl
Size 2.4 MB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
9c5d10527d0f9fb9dcdc5d05980797f0face4b6cd2be007df7fc55863ad74b43
BLAKE2b-256 checksum
How to use checksums
2f9c2919234284682396c89f2a088cf43bc8e0af9a0557a69217b9687fdbf827
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 27, 2026.

Transparency log

Security for pyferrum 1.0.0

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

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pyferrum-1.0.0.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 27, 2026.

Transparency log

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.0.0 This release

6 release files Full 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