Skip to main content

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 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.

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

typed_errs-0.0.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typed_errs-0.0.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file typed_errs-0.0.3.tar.gz.

File metadata

  • Download URL: typed_errs-0.0.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for typed_errs-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3546908a7a3b18582fa8eafaa1e0142891d479e991fd3428c55eb902bf7b30e9
MD5 64083191cc49c97030ec110660c8092d
BLAKE2b-256 39fb814bf45fce6189c08d06a1a3f591aa5311b23fa4e224a3728f68d971d367

See more details on using hashes here.

Provenance

The following attestation bundles were made for typed_errs-0.0.3.tar.gz:

Publisher: release.yml on 0xveya/typed-errs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typed_errs-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: typed_errs-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for typed_errs-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 833f38d0327004da1664f40cbe9968f629e092695ebd79db94a8f938d838dcf0
MD5 32d60263f541974c186133f42fe423ca
BLAKE2b-256 caffa7c4561eef627b1412ff1c6d30698e96fefb57c819f406975222f4f48e2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for typed_errs-0.0.3-py3-none-any.whl:

Publisher: release.yml on 0xveya/typed-errs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page