result
A Rust-like result type for Python
Decision gist · record as of 2026-08-14
Yes, if you prefer explicit error handling and type safety over exceptions. The package is stable, has low install friction, and is widely used (top 5000 PyPI). However, note that the repository is archived and abandoned—while the code is mature and unlikely to need updates, you will not receive maintenance or security patches. Use it for new projects only if your team is comfortable with that trade-off.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a single lightweight dependency (typing-extensions).
- Repository is archived and maintenance is abandoned as of 803 days since last release, though the package remains stable and widely used.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2024-06-02 (803 days) · last repo commit 2026-06-25 · 1,680 stars · archived
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,520,319 downloads/mo, #3,024 on PyPI
Alternatives
Verify before relying
pip install result
from result import Ok, Err, Result
def divide(a: int, b: int) -> Result[int, str]:
if b == 0:
return Err("Cannot divide by zero")
return Ok(a // b)
result = divide(10, 2)
if isinstance(result, Ok):
print(result.ok_value) # 5
else:
print(result.err_value)- Whether the archived repository status affects long-term security patch availability or community support for edge cases.
- Performance characteristics when used in high-throughput or latency-sensitive code paths compared to exception-based patterns.
What it is and what it does
Result is a type-safe container for representing success or failure outcomes without relying on exceptions. It provides Ok and Err classes that wrap values, letting you encode success or error states directly in function return types. The package is inspired by Rust's Result enum and fully type-annotated, making it compatible with MyPy and other type checkers for compile-time safety.
You use it by returning Ok(value) for success or Err(error) for failure, then checking the result with isinstance, is_ok/is_err functions, or Python 3.10+ match statements. It includes utility methods like map, unwrap, expect, and unwrap_or to transform and extract values. The design encourages explicit error handling at call sites rather than implicit exception propagation, making error paths visible in code.
Use it for
- Building APIs or functions where error cases are part of the normal control flow and should be handled explicitly rather than caught.
- Type-checking error handling with MyPy by narrowing result types through isinstance checks to ensure all branches are covered.
- Replacing tuple-based error returns (like returning (value, error_msg)) with a clearer, type-safe Result[T, E] signature.
- Chaining operations on results using map and map_err to transform values or errors without nested conditionals.
- Porting Rust code to Python while preserving the Result pattern for consistency and familiar error semantics.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you prefer explicit error handling and type safety over exceptions.
The package is stable, has low install friction, and is widely used (top 5000 PyPI). However, note that the repository is archived and abandoned—while the code is mature and unlikely to need updates, you will not receive maintenance or security patches. Use it for new projects only if your team is comfortable with that trade-off.
Install
result on PyPI
Before you install
Low install friction with a single lightweight dependency (typing-extensions). Repository is archived and maintenance is abandoned as of 803 days since last release, though the package remains stable and widely used.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install result
from result import Ok, Err, Result
def divide(a: int, b: int) -> Result[int, str]:
if b == 0:
return Err("Cannot divide by zero")
return Ok(a // b)
result = divide(10, 2)
if isinstance(result, Ok):
print(result.ok_value) # 5
else:
print(result.err_value)
Verify before relying
- Whether the archived repository status affects long-term security patch availability or community support for edge cases.
- Performance characteristics when used in high-throughput or latency-sensitive code paths compared to exception-based patterns.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Abandoned 803 days since the last release |
| Last repo commit | repository archived |
| First released | |
| Downloads | 2,520,319 / month, #3,024 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: result-0.17.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “rust result type python”
- resultProvides a Rust-inspired Result type for Python that represents…
- sccachesccache is a compiler caching wrapper that stores compilation results…
- pyxirrPyXIRR is a Rust-backed library that computes financial functions…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also setuptools-rust · regress · msgfy · python-status · pyre-extensions · better-exceptions · cargo-lambda · numerary · infinity · tree-sitter-rust