Structured effects for modern Python
Project description
pyfect
Structured effects for modern Python
Python is being used to build systems far larger and more concurrent than it was originally designed for. Async is now unavoidable, yet error handling, resource management, and concurrency remain ad‑hoc and fragile. Exceptions leak everywhere. Background tasks escape. The sync/async boundary infects entire codebases.
pyfect exists to make this situation survivable.
It provides a small, opinionated core for describing effects explicitly, handling errors as values, and enforcing structured concurrency — without turning Python into something unrecognizable.
What pyfect is
- A Python‑native effect system inspired by functional programming, not a port of another language
- A single execution model that can compose synchronous and asynchronous work
- Explicit errors that compose instead of exploding control flow
- Structured concurrency by default — no silent background work
- A runtime‑first design where safety is enforced at execution boundaries
pyfect favors clarity, discipline, and correctness over convenience magic.
What pyfect is not
- Not a framework
- Not a replacement for
asyncio, Trio, or AnyIO - Not “pure FP” or academic
- Not decorator‑driven async magic
- Not a grab‑bag of monadic utilities
pyfect does not attempt to encode the entire program in types, eliminate exceptions everywhere, or abstract away Python’s runtime model.
Design philosophy
Safety over convenience
If an operation can fail, it should say so. If work runs concurrently, it should be scoped. If resources are acquired, their lifetime should be explicit.
pyfect intentionally avoids APIs that:
- spawn unscoped background tasks
- swallow errors
- rely on implicit global state
- hide sync/async boundaries
Effects describe, runtimes decide
Effects are descriptions of work. Execution is centralized and controlled. Side effects only happen at the boundary, where they can be supervised, cancelled, logged, or traced.
Small core, honest utilities
The core of pyfect is intentionally small. Utilities are built on top — but only when they preserve explicit failure, structured concurrency, and resource safety.
Status
pyfect is in early design and exploration. The ideas and philosophy are being shaped before the implementation is finalized.
Expect breaking changes. Expect opinions. Expect discipline.
License
MIT
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 pyfect-0.2.1.tar.gz.
File metadata
- Download URL: pyfect-0.2.1.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
148eb6f4578c359a57e52b56898cc62b70ba2ee502f4d32ec541cbe679902a83
|
|
| MD5 |
f4efed88326602506727b1eaaf8a3ca2
|
|
| BLAKE2b-256 |
c022f28b3da727750dbe8042109fed2065b379d62ab8f6a888b80713eb496188
|
Provenance
The following attestation bundles were made for pyfect-0.2.1.tar.gz:
Publisher:
publish.yaml on pyfect/pyfect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfect-0.2.1.tar.gz -
Subject digest:
148eb6f4578c359a57e52b56898cc62b70ba2ee502f4d32ec541cbe679902a83 - Sigstore transparency entry: 937733630
- Sigstore integration time:
-
Permalink:
pyfect/pyfect@de90ab41af5308933a7093c9f3c83e741d69aa95 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyfect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@de90ab41af5308933a7093c9f3c83e741d69aa95 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyfect-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pyfect-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2991cf01e20640bb9383def064f5452c171d09b16ac690b977cebbfbce6549c
|
|
| MD5 |
6dd8bbe658b91b9d67e45f71b6f4f317
|
|
| BLAKE2b-256 |
3c3a7525ca93e711bb1ca91ca1fc3ddf5699e67468a0b9fcdfd61debade18fba
|
Provenance
The following attestation bundles were made for pyfect-0.2.1-py3-none-any.whl:
Publisher:
publish.yaml on pyfect/pyfect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfect-0.2.1-py3-none-any.whl -
Subject digest:
a2991cf01e20640bb9383def064f5452c171d09b16ac690b977cebbfbce6549c - Sigstore transparency entry: 937733644
- Sigstore integration time:
-
Permalink:
pyfect/pyfect@de90ab41af5308933a7093c9f3c83e741d69aa95 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/pyfect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@de90ab41af5308933a7093c9f3c83e741d69aa95 -
Trigger Event:
release
-
Statement type: