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.
Where I use it
This is my internal error-handling base for 42 projects. The generic Result,
Option, diagnostics, and bubbling helpers come from
coding/42/cc/pac-man; the same pattern is used throughout
coding/42/cc/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.
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.2.tar.gz.
File metadata
- Download URL: typed_errs-0.0.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787c354113cde7d96d3c11b3dc2bd4e27cf380a3c7f9d5147b3a25236476ba28
|
|
| MD5 |
d052bc449734decebc3a1d206076e090
|
|
| BLAKE2b-256 |
6e279379d99debcbb1b01cc0c30063951fc1cad0247b53bba3ba79a63add9db3
|
Provenance
The following attestation bundles were made for typed_errs-0.0.2.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.2.tar.gz -
Subject digest:
787c354113cde7d96d3c11b3dc2bd4e27cf380a3c7f9d5147b3a25236476ba28 - Sigstore transparency entry: 2397125881
- Sigstore integration time:
-
Permalink:
0xveya/typed-errs@3f061959a5b683941ea4b543359c5268f690f630 -
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@3f061959a5b683941ea4b543359c5268f690f630 -
Trigger Event:
push
-
Statement type:
File details
Details for the file typed_errs-0.0.2-py3-none-any.whl.
File metadata
- Download URL: typed_errs-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.9 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 |
d5798f994ca84e59d0be13f1d2ed084a674fe84def6f5384d141faf324057fec
|
|
| MD5 |
92fbb2d88c6062f8a0cb8a92f6f61a0e
|
|
| BLAKE2b-256 |
e9a50ba9989a1c9eaf44655aa808d4487cdacad634e69863cbbd8d4c31af3e51
|
Provenance
The following attestation bundles were made for typed_errs-0.0.2-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.2-py3-none-any.whl -
Subject digest:
d5798f994ca84e59d0be13f1d2ed084a674fe84def6f5384d141faf324057fec - Sigstore transparency entry: 2397125952
- Sigstore integration time:
-
Permalink:
0xveya/typed-errs@3f061959a5b683941ea4b543359c5268f690f630 -
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@3f061959a5b683941ea4b543359c5268f690f630 -
Trigger Event:
push
-
Statement type: