Transport-agnostic, async-first modular service application framework.
Project description
PyFerOx
Transport-agnostic, async-first Python service framework built around:
- typed command/query/event contracts
- modular composition
- execution middleware + lifecycle hooks
- pluggable transports (HTTP, jobs/worker, RPC, scheduler)
Project Status
Phase 1-3 implementation is complete according to repository audits:
Documentation
Full user docs are in docs/.
Recommended start:
- Quickstart
- Core Concepts
- HTTP, Auth, OpenAPI
- Persistence (SQLAlchemy)
- Background and Distributed Runtime
- Testing
- Configuration
- CLI Reference
- Operations and Tuning
Install
pip install -e ".[dev,http]"
Minimal Example
from pyferox import App, HTTPAdapter, Module, StructCommand, StructQuery, handle, singleton
class UserRepo:
async def create(self, email: str, name: str) -> int:
return 1
async def get(self, user_id: int) -> dict[str, str]:
return {"id": str(user_id), "email": "user@example.com", "name": "User"}
class CreateUser(StructCommand):
email: str
name: str
class GetUser(StructQuery):
user_id: int
@handle(CreateUser)
async def create_user(cmd: CreateUser, users: UserRepo) -> dict[str, int]:
return {"id": await users.create(cmd.email, cmd.name)}
@handle(GetUser)
async def get_user(query: GetUser, users: UserRepo) -> dict[str, str]:
return await users.get(query.user_id)
app = App(modules=[Module(handlers=[create_user, get_user], providers=[singleton(UserRepo())])])
http = HTTPAdapter(app)
http.command("POST", "/users", CreateUser, status_code=201)
http.query("GET", "/users/{user_id}", GetUser)
PyFerOx is msgspec-backed. For new transport-facing contracts, prefer StructCommand / StructQuery / StructEvent. Dataclass contracts are still supported, but they are not the primary style to teach in user-facing examples.
Run:
uvicorn app.main:http --reload
Or scaffold first:
pyferox create-project demo_service --template api
cd demo_service
pyferox run-dev --target app.main:http
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 pyferox-0.0.2.tar.gz.
File metadata
- Download URL: pyferox-0.0.2.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc6e0b80413a30cdb8d88337a85d81eff7c9fd3bc6449dab5bd896dc03c73e24
|
|
| MD5 |
d33e02604dc737521f4db9256640d6ae
|
|
| BLAKE2b-256 |
a4653f44795972f8cb9eeb0a79cdd0bdf3564986c005617b43b9f0472cb5f436
|
File details
Details for the file pyferox-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pyferox-0.0.2-py3-none-any.whl
- Upload date:
- Size: 58.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f144d62fb8038f464e56474cefd976d515e12f4f593fdc0785bb94653a225b
|
|
| MD5 |
52d24130a899c05b3d22675328c65509
|
|
| BLAKE2b-256 |
7d1378d43bd75b601fbb758ffb514b9575b488493093d7e893fad3ab62041e8c
|