Skip to content

Releases: mplanchard/safetywrap

v1.5.0 - Covariance of Wrapped Types

23 Sep 23:04
v1.5.0
c360380
Compare
Choose a tag to compare

1.5.0 - 2020-09-23

Added

  • Type inference now allows covariance for Result and Option wrapped types
    • Allows a function of type Callable[[int], RuntimeError] to be applied
      via flatmap (.and_then()) to a result of type Result[int, Exception]
    • Allows e.g. any of the following to be assigned to a type of
      Result[Number, Exception]:
      • Result[int, RuntimeError]
      • Result[float, TypeError]
      • etc.
    • This makes .and_then()/.flatmap(), .map(), .map_err(), and so on
      much more convenient to use in result chains.

v1.4.0 - Add new Option.collect() constructor

09 Mar 20:28
Compare
Choose a tag to compare

1.4.0 - 2020-03-09

Added

  • New Option.collect constructor to create an Option[Tuple[T, ...]]
    from an iterable of Option[T]. If all Options in the iterator are Some[T],
    they are collected into a tuple in the resulting Some. If any are
    Nothing(), the result is Nothing().

v1.3.1 - Fix pylint `assignment-from-no-return` warning

21 Feb 22:15
Compare
Choose a tag to compare

1.3.1 - 2020-02-21

Fixed

  • Fix pylint assignment-from-no-return warnings for methods that can only
    raise, seen when pylint can determine whether a value is an Ok/Err or
    Some/Nothing and you try to e.g. Err(5).expect("no good").

v1.3.0 - Python 3.8 Support, Option.raise_if_nothing()

12 Jan 15:25
v1.3.0
fdf8564
Compare
Choose a tag to compare

1.3.0 - 2019-01-12

Added

  • Testing in CI for Python 3.8
  • Option.raise_if_nothing(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
    added as a semantically friendly alias for Option.expect.

Deprecated

  • Option.raise_if_err is deprecated in favor of Option.raise_if_nothing.
    Will be removed in 2.0.0

v1.2.0 - raise_if_err() alias for expect()

09 Jan 19:33
Compare
Choose a tag to compare

Added

  • Result.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
    added as a semantically friendly alias for Result.expect (thanks @MustardForBreakfast!)
  • Option.raise_if_err(self, msg: str, exc_cls: t.Type[Exception] = RuntimeError) -> T
    added as a semantically friendly alias for Option.expect (thanks @MustardForBreakfast!)

v1.1.0 - Result.collect() constructor

03 Jan 19:48
Compare
Choose a tag to compare

1.1.0 - 2019-01-03

Added

  • Result.collect(iterable: Iterable[T, E]) -> Result[Tuple[T, ...], E] added
    to collect an iterable of results into a single result, short-circuiting
    if any errors are encountered

v1.0.2 - Include context in expect output

12 Dec 21:38
Compare
Choose a tag to compare

Fixed

  • Result.expect() and Result.expect_err() now appends the stringified
    Err or Ok result to the provided msg.

v1.0.1 - Improve Type Hinting

09 Dec 17:41
Compare
Choose a tag to compare

Fixed

  • All interface methods now, through the magic of dependent imports, specify
    that they should return implementation instances. This makes working with
    functions specified to return a Result or an Option much easier (1780999)

v1.0.0 - Initial Release

09 Dec 17:42
v1.0.0
3a6827a
Compare
Choose a tag to compare

Added

  • Result and Option generic type interfaces
  • Ok and Err Result implementations
  • Some and Nothing Option implementations
  • CI pipeline with Azure pipelines
  • Full public interface testing
  • Makefile for common operations, including venv setup, linting, formatting,
    and testing
  • Basic benchmarks for analyzing performance
  • Apache license