Skip to main content

crashbytes-result

A practical Result type for Python — Ok, Err, and pattern matching.

Install

pip install crashbytes-result

Usage

from crashbytes_result import Ok, Err, Result, safe

def divide(a: float, b: float) -> Result[float, str]:
    if b == 0:
        return Err("division by zero")
    return Ok(a / b)

result = divide(10, 3)
match result:
    case Ok(value):
        print(f"Result: {value}")
    case Err(error):
        print(f"Error: {error}")

# Or use .match()
msg = result.match(
    ok=lambda v: f"Got {v:.2f}",
    err=lambda e: f"Failed: {e}",
)

# @safe decorator
@safe
def parse_int(s: str) -> int:
    return int(s)

parse_int("42")   # Ok(42)
parse_int("abc")  # Err(ValueError(...))

API

Method Ok Err
.unwrap() Returns value Raises UnwrapError
.unwrap_or(default) Returns value Returns default
.unwrap_err() Raises UnwrapError Returns error
.map(fn) Ok(fn(value)) self
.map_err(fn) self Err(fn(error))
.bind(fn) fn(value) self
.match(ok, err) ok(value) err(error)
.is_ok True False
.is_err False True

License

MIT

Metadata

Release files for crashbytes-result 1.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crashbytes-result 1.1.10
File Size Uploaded Provenance Actions
crashbytes_result-1.1.10.tar.gz 52.4 kB With provenance Details for crashbytes_result-1.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for crashbytes-result 1.1.10
File Interpreter ABI Platform Actions
crashbytes_result-1.1.10-py3-none-any.whl Python 3 none any Details for crashbytes_result-1.1.10-py3-none-any.whl

Total release size: 57.0 kB

Release files / crashbytes_result-1.1.10.tar.gz

Download URL crashbytes_result-1.1.10.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d3734167ce391351cdf4f062e85bf328b66b6227c722c45568caa25f573860bb
BLAKE2b-256 checksum
How to use checksums
8ac534e0ada33c2b24b1000905575e2a249d4003ce9cd326a6d2adc3357efbfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / crashbytes_result-1.1.10-py3-none-any.whl

Download URL crashbytes_result-1.1.10-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40260ab2fa3e5d2931da5f7dcc8aff324e029c6dd2b672ad5665328dc0a63959
BLAKE2b-256 checksum
How to use checksums
4229559349c27c3489f24fdb365e980158de38310e847acc145b3cd950b6cf86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for crashbytes-result 1.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for crashbytes_result-1.1.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page