Skip to content

Releases: leodiegues/unwrappy

unwrappy v0.1.0

19 Jan 09:38
c422136

Choose a tag to compare

Rust-inspired Result and Option types for Python.

unwrappy brings explicit, type-safe error handling to Python without the complexity of full functional programming libraries.

Highlights

  • Result[T, E] - Represent success (Ok) or failure (Err) as values, not exceptions
  • Option[T] - Handle optional values with Some and Nothing (no more None ambiguity)
  • LazyResult & LazyOption - Clean async chaining without nested awaits
  • Pattern Matching - Native Python 3.10+ structural matching support
  • Zero Dependencies - Pure Python, just stdlib

Why unwrappy?

from unwrappy import Ok, Err, Result

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

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

Links