typed-errs
Small, typed Result and Option values for Python code that wants explicit
failure paths without exceptions crossing API boundaries.
uv add typed-errs
Example
from enum import Enum, auto
from typed_errs import Err, Ok, Result, catch_bubble
class ReadError(Enum):
NOT_FOUND = auto()
def read_name() -> Result[str, ReadError]:
return Ok("Veya")
@catch_bubble
def greeting() -> Result[str, ReadError]:
name = read_name().q
return Ok(f"hello {name}")
Define each application's error categories as normal Enum classes. Err
stores that enum plus an optional Diagnostic, namespace, and context message.
The package also provides Some, Nothing, Option, catch_bubble, and
catch_nothing.
The .q property is intended for functions decorated with catch_bubble: it
unwraps Ok and returns the first Err from the decorated function. For normal
branching, use isinstance(result, Ok) / isinstance(result, Err), match, or
the mapping and inspection methods. See the runnable
pipeline example for validation and early returns.
Where I use it
This is my internal error-handling base for 42 projects. The generic Result,
Option, diagnostics, and bubbling helpers come from
Pacman, a
work-in-progress group project in the 42 organization.
The same pattern is used throughout
RAG Against the Machine,
call_me_maybe, and
fly-in for CLI, file parsing, storage,
indexing, watcher, and web-service failures. Projects define their own error
Enum and return Ok or Err instead of copying the implementation again.
Dependencies
No runtime dependencies. Python 3.10 or newer.
Use and contributions
This is a personal library, but it is not private or locked to my projects. You may use it in general Python work and in 42 projects under the MIT license; just follow the rules that apply to your campus and assignment.
Contributions are welcome: open an issue or send a pull request. I do not care whether a contribution is written by hand, AI-assisted, or generated another way; I care about whether it is correct, tested, understandable, and a good fit. Because this is opinionated personal infrastructure, pull requests are reviewed selectively and are likely to be rejected unless they clearly improve the library without making it harder to maintain.
Development and release
Run mise run check for lint, type checks, tests, and a package build. Every
push to master publishes a unique 0.0.<CI run> ZeroVer version through PyPI Trusted
Publishing. mise run publish remains available for manual publishing.
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 typed_errs-0.0.4.tar.gz.
File metadata
- Download URL: typed_errs-0.0.4.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd65ec3f455e1eee2cad51ce4a65b6c9e7920ac4bfab4368e057ac21e6b541fe
|
|
| MD5 |
cf65f3c4a7cd695441926523b4d3d8ec
|
|
| BLAKE2b-256 |
b651bc19ad946077f83d497a06c8170b6f469573feda3b6b433b56d30fef83d9
|
Provenance
The following attestation bundles were made for typed_errs-0.0.4.tar.gz:
Publisher:
release.yml on 0xveya/typed-errs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typed_errs-0.0.4.tar.gz -
Subject digest:
fd65ec3f455e1eee2cad51ce4a65b6c9e7920ac4bfab4368e057ac21e6b541fe - Sigstore transparency entry: 2397206089
- Sigstore integration time:
-
Permalink:
0xveya/typed-errs@0769b16ef5980dc142a8f55e9322cffbe603538c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/0xveya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0769b16ef5980dc142a8f55e9322cffbe603538c -
Trigger Event:
push
-
Statement type:
File details
Details for the file typed_errs-0.0.4-py3-none-any.whl.
File metadata
- Download URL: typed_errs-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf82e35a8a580f48e847c2abe192bdabdcc8146f25e40e404840768827698f72
|
|
| MD5 |
14ccbd32073799910f7fe3115e8f4bee
|
|
| BLAKE2b-256 |
a45b55391c35daa08c81c4c75ef7e05f863af613bb39eb14fdb31e71cf038495
|
Provenance
The following attestation bundles were made for typed_errs-0.0.4-py3-none-any.whl:
Publisher:
release.yml on 0xveya/typed-errs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typed_errs-0.0.4-py3-none-any.whl -
Subject digest:
bf82e35a8a580f48e847c2abe192bdabdcc8146f25e40e404840768827698f72 - Sigstore transparency entry: 2397206153
- Sigstore integration time:
-
Permalink:
0xveya/typed-errs@0769b16ef5980dc142a8f55e9322cffbe603538c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/0xveya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0769b16ef5980dc142a8f55e9322cffbe603538c -
Trigger Event:
push
-
Statement type: