Skip to content

Releases: dry-python/returns

Version 0.22.0

26 Aug 13:41
7cf5ef5
Compare
Choose a tag to compare

Features

  • Breaking: Drops python3.7 support
  • Now requires mypy>=1.5
  • Adds trampolines support

Version 0.21.0

27 Jun 15:47
b11c288
Compare
Choose a tag to compare

Features

  • Now requires mypy>=1.4
  • Adds [compatible-mypy] extra for installation

Version 0.20.1

23 Jun 20:29
c25ee24
Compare
Choose a tag to compare

Bugfixes

  • Fixed HKT to_str example in documentation
  • Fixed backward deserialization compatibility for BaseContainer

Version 0.20.0

21 Apr 13:14
efa9b2d
Compare
Choose a tag to compare

Features

  • Now requires mypy>=1.2

Bugfixes

  • Fixes a problem with do-notation and type aliases
  • Fixes custom pickle protocol to handle None values gracefully
  • Removes broken drylabs.io link in README
  • Revises pointfree documentation

0.19.0 aka The Do Notation

13 Mar 14:33
499bbdf
Compare
Choose a tag to compare

Features

  • Adds do notation
  • Adds attempt decorator

Misc

  • Check __slots__ correctness with slotscheck

Version 0.18.0

31 Dec 16:50
97d8918
Compare
Choose a tag to compare

New Year Release! 🎄

Features

  • Now requires typing_extensions>=4.0
  • Now requires mypy>=0.930
  • Removes plugin for @safe, @maybe, @future, etc.
    Because we now use ParamSpec type to properly type decorators

Bugfixes

  • Fixes __slots__ not being set properly in containers and their base classes
  • Fixes patching of containers in pytest plugin not undone after each test

Version 0.17.0

05 Oct 07:48
6662b60
Compare
Choose a tag to compare

Features

  • Python3.10 support
  • Enables Pattern Matching support for Result containers
  • Enables Pattern Matching support for Maybe container
  • Enables Pattern Matching support for IOResult container
  • Improves hypothesis plugin, now we detect
    when type cannot be constructed and give a clear error message

Version 0.16.0

26 Mar 15:34
36e7cbf
Compare
Choose a tag to compare

Features

  • Makes _Nothing a singleton
  • Refactor flow function to be faster

Bugfixes

  • Fixes that assert_trace was not catching containers
    from @safe-wrapped functions

Misc

  • Fixes typos in documentation

Version 0.15.0 aka The initial HKT release

21 Oct 17:15
12e4227
Compare
Choose a tag to compare

Features

  • Adds Higher Kinded Types partial support

  • Breaking: drops python3.6 support

  • Breaking: makes our mypy plugin not optional, but required!

  • Breaking: changes all RequiresContext-based type arguments order,
    previously we used to specify _EnvType as the first type argument,
    now it is the last one. This is done to respect new HKT rules

  • Breaking: renames .rescue to .lash

  • Breaking: removes all old interfaces from primitives/interfaces.py,
    use new typeclasses instead

  • Breaking: Maybe is fully reworked to be lawful

  • Breaking: removes value_or pointfree method,
    because it is impossible to express with HKT

  • Breaking: removes .value_or, .unwrap, and .failure methods
    from FutureResult and RequiresContext-based types,
    because we do require these methods to raise an exception on failure,
    but these methods were lazy and did not raise the required exception

  • Breaking: changes how is_successful is typed:
    now we allow any Unwrappable interface instances there,
    including custom ones

  • Breaking: changes UnwrapFailedError constructor,
    now it does accept an Unwrappable instance instead of a BaseContainer

  • Breaking: removes .fix method from all containers,
    also removes fix pointfree function

  • Breaking: Removes coalesce function,
    because it is impossible to properly type it

  • Breaking: Removes all Context* based types with .ask() method,
    use new .ask() methods on the Reader-based containers

  • Breaking: Now Future and FutureResult can be awaited multiple times

  • Breaking: Removes .unify() method from several containers,
    use unify() pointfree function instead

  • Breaking: Removes .from_iterable method from all containers,
    instead adds better iterables support,
    we now have returns.iterables module with Fold helper

  • Breaking: Renames property empty to no_args of
    all RequiresContext-based classes

  • Adds new public interfaces: see returns.interfaces

  • Adds methods package with several helpful things inside

  • Adds FutureSuccess and FutureFailure unit functions
    to be similar to Result and IOResult

  • Adds .swap method to Result, IOResult, FutureResult,
    and other result based containers

  • Adds .modify_env method to all RequiresContext* types

  • Adds .rescue to Maybe

  • Adds .equals methods to types that can be compared directly:
    Result, Maybe, IO, IOResult

  • Adds missing from_requires_context_future_result to RequiresContext

  • Adds .from_optional and .bind_optional to Maybe container

  • Adds __slots__ to UnwrapFailedError with halted_container

  • Changes flatten to work with KindN and any possible container

  • Adds a helper to test traces to our pytest plugin

  • Adds cond function to pointfree and methods packages

  • Adds compose_result HKT method and pointfree function

  • Adds unify HKT pointfree function

  • Adds bimap pointfree function

  • Adds unwrap_or_failure function to methods package

  • Adds collect_trace helper function for better development experience

  • Adds hypothesis intergration and pre-defined "monad laws as values"

  • Adds assert_equal method to our pytest plugin

Bugfixes

  • Breaking: fixes serious typing issue and changes how flow works
  • Breaking: fixes serious typing issue and changes how pipe works,
    now it has a hard limit of 20 parameters
  • Fixes that RequiresContextFutureResult was not supported by pytest plugin
  • Fixes incorrect partial behaviour in an edge case, #618
  • Fixes that .apply method of IOResult was working incorrectly,
    it was returning IOFailure(2)
    as a result of IOFailure(1).apply(IOFailure(2))
  • Fixes bug that safe(tap(...)) was revealing invalid types sometimes

Misc

  • Adds a lot of new typetests
  • Checks that now all math laws are checked for all types
  • Changes docs structure, adds new Interfaces, HKT, and Methods pages
  • Changed __str__ method in BaseContainer class to __repr__ method
  • Adds Quickstart guide

Version 0.14.0

07 Jun 21:00
6b9662e
Compare
Choose a tag to compare

Special thanks to:

Announcement: https://sobolevn.me/2020/06/how-async-should-have-been

Features

  • Breaking: renames mypy plugin from decorator_plugin to returns_plugin
    because of a complete rewrite and lots of new features

  • Breaking: changes @safe, @impure, impure_safe, @maybe semantics:
    they do not work with async functions anymore;
    now you are forced to use Future and its helpers
    to work with async functions

  • Breaking: renames Maybe.new to Maybe.from_value.
    Because all our other containers support this protocol.
    Only Maybe was different, sorry for that!

  • Breaking: renames .from_success() to .from_value(),
    there's no need in two separate methods

  • Breaking: renames .from_successful_io() to .from_io(),
    there's no need in two separate methods

  • Breaking: renames .from_successful_context() to .from_context(),
    there's no need in two separate methods

  • Breaking: since we now support .apply() method,
    there's no more need in *_squash converters, they are removed

  • Breaking: renamed Instanceable to Applicative

  • Breaking: changes .from_io and .from_failed_io of IOResult
    to return Any instead of NoReturn unfilled type

  • Breaking: removes .lift and .lift_* methods from all containers,
    use map_, bind_result, bind_io, and other pointfree helpers instead

  • Breaking: removes @pipeline function. It was a mistake:
    it does not work with mixed container types,
    it does not type failures properly,
    it does not work with IO and Future,
    it enforces to write imperative code in a functional codebase.
    Use flow instead

  • Adds typed partial and curry mypy plugins!

  • Adds typed flow plugin, now it can accept any number of arguments,
    it now also has excelent type inference

  • Adds typed pipe plugin, now it can accept any number of arguments,
    it now also has good type inference

  • Adds managed pipeline function that is useful
    for working with stateful computations

  • Adds typed map_, fix, and alt pointfree functions

  • Adds typed bind_result, bind_io, bind_ioresult,
    bind_context, bind_context_result, bind_future,
    bind_async, and bind_awaitable pointfree functions

  • Adds typed bind_async_future and bind_async_future_result
    pointfree functions

  • Adds typed unify pointfree function

  • Adds typed apply pointfree function

  • Adds typed value_or pointfree function

  • Adds pytest plugin with the ability to tests error handling

  • Adds Future container to easily work with async functions

  • Adds FutureResult container to easily work
    with async function that might fail

  • Adds RequiresContextFutureResult container

  • Adds ReaderFutureResult alias for RequiresContextFutureResult

  • Adds RequiresContextFutureResultE and ReaderFutureResultE aliases

  • Adds Future, FutureResult and RequiresContextFutureResult
    support for all existing pointfree functions

  • Adds bind_io method to IOResult

  • Adds bind_io method to RequiresContextIOResult

  • Adds or_else method to Maybe

  • Adds .from_io and .from_failed_io to RequiresContextIOResult

  • Syncs naming in from_* methods, now all parameters are named inner_value

  • Adds not_ composition helper

  • Adds flatten support for Future,
    FutureResult and RequiresContextFutureResult

  • Adds __copy__ and __deepcopy__ magic methods to Immutable class

  • Speeds up is_successful function

  • Makes all Context context helpers abstract,
    so you cannot create new instances of this class,
    also adds __slots__ to these classes

  • Improves RequiresContext* types with NoDeps where it is logically true

Bugfixes

  • Fixes that @safe decorator was generating incorrect signatures
    for functions with Any
  • Fixes that .rescue() of RequiresContextResult was returning Any
  • Fixes that .rescue() of RequiresContextIOResult was returning Any
  • Fixes that RequiresContextResult and RequiresContextIOResult
    were not final
  • Fixes that ImmutableStateError was not a subclass of AttributeError
  • Fixes that IOResult was not showing str representation
    of wrapped inner_value

Misc

  • Replaces pytest-asyncio with anyio plugin,
    now we test compatibility with any IO stack: asyncio, trio, curio
  • Updates lots of dependencies
  • Adds lots of new tests
  • Updates lots of docs
  • Removes "IO marker" name from docs in favor for "IO container",
    it is not special at all. Why would we call it differently?