We follow Semantic Versions since the 1.0.0 release.
Versions before 1.0.0 are 0Ver-based:
incremental in minor, bugfixes only are patches.
See 0Ver.
- Added
mypy>=1.16,<1.18support - Added
__bool__toMaybe, onlyNothingever returnsFalse
- A lot of new features added to our
hypothesisplugins. It now allows to create custom strategies, better instantiate containers, docouple it from built-in ones, check laws from user-defined interfaces
- Fixes that
UnwrapFailedErrorwas not picklable
- Drop
python3.9support - Add
python3.13support - Add support for
mypy>=1.12 - Add picky exceptions to
future_safedecorator likesafehas - Improve inference of
ResultLikeobjects when exception catching decorator is applied with explicit exception types - Add picky exceptions to
impure_safedecorator likesafehas. Issue #1543 - Add partition function to result module. Issue #1905
- Add
default_errorparameter toreturns.converters.maybe_to_result, which provides a default error value forFailure
- Make
hypothesisplugin test laws from user-defined interfaces too - Make
hypothesisplugin accept user-defined strategies - Allow users to override the
hypothesisplugin's strategies for types, such asTypeVarandCallable.
- Add pickling support for
UnwrapFailedErrorexception
- Breaking: Remove
success_typeandfailure_typefields fromIOResult,MaybeandResulttypes
- Now requires
mypy>=1.10 - Adds
[check-laws]extra for installation
- Breaking: Drops
python3.7support - Now requires
mypy>=1.5 - Adds
trampolinessupport
- Now requires
mypy>=1.4 - Adds
[compatible-mypy]extra for installation
- Fixed HKT
to_strexample in documentation - Fixed backward deserialization compatibility for BaseContainer
- Now requires
mypy>=1.2
- Fixes a problem with
do-notationand type aliases - Fixes custom pickle protocol to handle
Nonevalues gracefully - Removes broken drylabs.io link in README
- Revises pointfree documentation
- Adds
donotation - Adds
attemptdecorator
- Check
__slots__correctness withslotscheck
New Year Release! 🎄
- Now requires
typing_extensions>=4.0 - Now requires
mypy>=0.930 - Removes plugin for
@safe,@maybe,@future, etc. Because we now useParamSpectype to properly type decorators
- Fixes
__slots__not being set properly in containers and their base classes - Fixes patching of containers in pytest plugin not undone after each test
- Enables Pattern Matching support for
Resultcontainers - Enables Pattern Matching support for
Maybecontainer - Enables Pattern Matching support for
IOResultcontainer - Improves
hypothesisplugin, now we detect when type cannot be constructed and give a clear error message - Adds the option to pass what exceptions
@safewill handle
- Makes
_Nothinga singleton - Refactor
flowfunction to be faster
- Fixes that
assert_tracewas not catching containers from@safe-wrapped functions
- Fixes typos in documentation
-
Adds Higher Kinded Types partial support
-
Breaking: drops
python3.6support -
Breaking: makes our
mypyplugin not optional, but required! -
Breaking: changes all
RequiresContext-based type arguments order, previously we used to specify_EnvTypeas the first type argument, now it is the last one. This is done to respect new HKT rules -
Breaking: renames
.rescueto.lash -
Breaking: removes all old interfaces from
primitives/interfaces.py, use new typeclasses instead -
Breaking:
Maybeis fully reworked to be lawful -
Breaking: removes
value_orpointfree method, because it is impossible to express with HKT -
Breaking: removes
.value_or,.unwrap, and.failuremethods fromFutureResultandRequiresContext-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_successfulis typed: now we allow anyUnwrappableinterface instances there, including custom ones -
Breaking: changes
UnwrapFailedErrorconstructor, now it does accept anUnwrappableinstance instead of aBaseContainer -
Breaking: removes
.fixmethod from all containers, also removesfixpointfree function -
Breaking: Removes
coalescefunction, because it is impossible to properly type it -
Breaking: Removes all
Context*based types with.ask()method, use new.ask()methods on theReader-based containers -
Breaking: Now
FutureandFutureResultcan be awaited multiple times -
Breaking: Removes
.unify()method from several containers, useunify()pointfree function instead -
Breaking: Removes
.from_iterablemethod from all containers, instead adds betteriterablessupport, we now havereturns.iterablesmodule withFoldhelper -
Breaking: Renames property
emptytono_argsof allRequiresContext-based classes -
Adds new public interfaces: see
returns.interfaces -
Adds
methodspackage with several helpful things inside -
Adds
FutureSuccessandFutureFailureunit functions to be similar toResultandIOResult -
Adds
.swapmethod toResult,IOResult,FutureResult, and other result based containers -
Adds
.modify_envmethod to allRequiresContext*types -
Adds
.rescuetoMaybe -
Adds
.equalsmethods to types that can be compared directly:Result,Maybe,IO,IOResult -
Adds missing
from_requires_context_future_resulttoRequiresContext -
Adds
.from_optionaland.bind_optionaltoMaybecontainer -
Adds
__slots__toUnwrapFailedErrorwithhalted_container -
Changes
flattento work withKindNand any possible container -
Adds a helper to test traces to our
pytestplugin -
Adds
condfunction topointfreeandmethodspackages -
Adds
compose_resultHKT method and pointfree function -
Adds
unifyHKT pointfree function -
Adds
bimappointfree function -
Adds
unwrap_or_failurefunction tomethodspackage -
Adds
collect_tracehelper function for better development experience -
Adds
hypothesisintegration and pre-defined "monad laws as values" -
Adds
assert_equalmethod to ourpytestplugin
- Breaking: fixes serious typing issue and changes how
flowworks - Breaking: fixes serious typing issue and changes how
pipeworks, now it has a hard limit of 20 parameters - Fixes that
RequiresContextFutureResultwas not supported bypytestplugin - Fixes incorrect
partialbehaviour in an edge case, #618 - Fixes that
.applymethod ofIOResultwas working incorrectly, it was returningIOFailure(2)as a result ofIOFailure(1).apply(IOFailure(2)) - Fixes bug that
safe(tap(...))was revealing invalid types sometimes
- Adds a lot of new typetests
- Checks that now all math laws are checked for all types
- Changes docs structure, adds new
Interfaces,HKT, andMethodspages - Changed
__str__method inBaseContainerclass to__repr__method - Adds
Quickstartguide
-
Breaking: renames mypy plugin from
decorator_plugintoreturns_pluginbecause of a complete rewrite and lots of new features -
Breaking: changes
@safe,@impure,impure_safe,@maybesemantics: they do not work withasyncfunctions anymore; now you are forced to useFutureand its helpers to work withasyncfunctions -
Breaking: renames
Maybe.newtoMaybe.from_value. Because all our other containers support this protocol. OnlyMaybewas 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*_squashconverters, they are removed -
Breaking: renamed
InstanceabletoApplicative -
Breaking: changes
.from_ioand.from_failed_ioofIOResultto returnAnyinstead ofNoReturnunfilled type -
Breaking: removes
.liftand.lift_*methods from all containers, usemap_,bind_result,bind_io, and other pointfree helpers instead -
Breaking: removes
@pipelinefunction. It was a mistake: it does not work with mixed container types, it does not type failures properly, it does not work withIOandFuture, it enforces to write imperative code in a functional codebase. Useflowinstead -
Adds typed
partialandcurrymypy plugins! -
Adds typed
flowplugin, now it can accept any number of arguments, it now also has excellent type inference -
Adds typed
pipeplugin, now it can accept any number of arguments, it now also has good type inference -
Adds
managedpipeline function that is useful for working with stateful computations -
Adds typed
map_,fix, andaltpointfree functions -
Adds typed
bind_result,bind_io,bind_ioresult,bind_context,bind_context_result,bind_future,bind_async, andbind_awaitablepointfree functions -
Adds typed
bind_async_futureandbind_async_future_resultpointfree functions -
Adds typed
unifypointfree function -
Adds typed
applypointfree function -
Adds typed
value_orpointfree function -
Adds
pytestplugin with the ability to tests error handling -
Adds
Futurecontainer to easily work withasyncfunctions -
Adds
FutureResultcontainer to easily work withasyncfunction that might fail -
Adds
RequiresContextFutureResultcontainer -
Adds
ReaderFutureResultalias forRequiresContextFutureResult -
Adds
RequiresContextFutureResultEandReaderFutureResultEaliases -
Adds
Future,FutureResultandRequiresContextFutureResultsupport for all existing pointfree functions -
Adds
bind_iomethod toIOResult -
Adds
bind_iomethod toRequiresContextIOResult -
Adds
or_elsemethod toMaybe -
Adds
.from_ioand.from_failed_iotoRequiresContextIOResult -
Syncs naming in
from_*methods, now all parameters are namedinner_value -
Adds
not_composition helper -
Adds
flattensupport forFuture,FutureResultandRequiresContextFutureResult -
Adds
__copy__and__deepcopy__magic methods toImmutableclass -
Speeds up
is_successfulfunction -
Makes all
Contextcontext helpers abstract, so you cannot create new instances of this class, also adds__slots__to these classes -
Improves
RequiresContext*types withNoDepswhere it is logically true
- Fixes that
@safedecorator was generating incorrect signatures for functions withAny - Fixes that
.rescue()ofRequiresContextResultwas returningAny - Fixes that
.rescue()ofRequiresContextIOResultwas returningAny - Fixes that
RequiresContextResultandRequiresContextIOResultwere notfinal - Fixes that
ImmutableStateErrorwas not a subclass ofAttributeError - Fixes that
IOResultwas not showingstrrepresentation of wrappedinner_value
- Replaces
pytest-asynciowithanyioplugin, 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?
-
Breaking: renames
jointoflatten, sorry! -
Breaking: renames
boxtobindand moves it toreturns.pointfree -
Breaking: removes
Maybe.rescueandMaybe.fixmethods -
Breaking: renames
io_squashtosquash_ioand moves it toreturns.converters -
Breaking: moves all interfaces from
returns.primitives.containertoreturns.primitives.interfaces -
Adds
rescuepointfree function -
Adds
ResultEalias forResult[..., Exception] -
Adds
RequiresContextcontainer andContexthelper class -
Adds
RequiresContextsupport forbindpointfree function -
Adds
RequiresContextsupport forflattenfunction -
Adds
RequiresContextResultcontainer -
Adds
RequiresContextResultEalias -
Adds
ReaderResultandReaderResultEaliases forRequiresContextResult[..., ..., Exception] -
Adds
RequiresContextResultsupport forbindandrescue -
Adds
RequiresContextResultsupport forflatten -
Adds
IOResulthelper to work better withIO[Result[a, b]] -
Adds
IOResultEalias forIOResult[a, Exception] -
Adds
IOResultsupport forbind -
Adds
IOResultsupport forflatten -
Adds
IOResultsupport for@pipeline -
Adds
IOResultsupport forcoalesce -
Adds
IOResultsupport foris_successful -
Adds
RequiresContextIOResultcontainer -
Adds
RequiresContextIOResultEalias -
Adds
ReaderIOResultandReaderIOResultEaliases forRequiresContextIOResult[..., ..., Exception] -
Adds
RequiresContextIOResultsupport forbindandrescue -
Adds
RequiresContextIOResultsupport forflatten -
Adds
Result.lift,Maybe.lift,RequiresContext.lift, andRequiresContextResult.liftfunctions in addition toIO.lift -
Adds
Immutableprimitive type -
Adds
Unitableprotocol and.from_success()and.from_failure()methods for allResultrelated classes -
Adds
Instanceableprotocol and.from_value()method forIOandRequiresContext -
Adds
flowfunction, which is similar topipe -
Adds
swapconverter forResultandIOResult -
Adds
squash_contextfunction to squashRequiresContextsimilar toIO
- Now
SuccessandFailure(bothioand pure) returnAnyand notNoReturn - Fixes how
flattenworks, also adds more tests and docs aboutFailurecase - Fixes
Unwrappabletype being parametrized with only oneTypeVar - Changes
SuccessandFailureto returnAnyinstead ofNoReturn
- Updates
poetryversion intravis - Improves
pipedocs withlambdaandGenericproblem - Improves docs in several places
- Now examples in docs tries to be docstests where possible
- Changes how tests are checked with
mypyin CI
- Breaking: now
@pipelinerequires a container type when created:@pipeline(Result)or@pipeline(Maybe) MaybeandResultnow hassuccess_typeandfailure_typealiases- Adds
Result.unifyutility method for better error type composition - We now support
dry-python/classesas a first-class citizen - Adds
io_squashto squash severalIOcontainers into one container with a tuple inside, currently works with9containers max at a time - Adds
untapfunction which does convert return type toNone
- Fixes that containers were not usable with
multiprocessing - Changes the inheritance order, now
BaseContaineris the first child - Fixes that
Nothinghad incorrect docstrings
- Now
generatedpackage is protected - Updates
poetryto1.0
- Breaking: now
pipe()does not require argument to be the first value, instead it is required to use:pipe(f1, f2, f3, f4)(value) - Breaking: dropped everything from
returns/__init__.py, because we now have quite a lot of stuff - Breaking: dropped support of zero argument functions for
Nothing.fix - Breaking: dropped support of zero argument functions for
Nothing.rescue Maybenow has.failure()to match the same API asResult- Adds
identityfunction - Adds
tapfunction - Now
pipeallows to pipe 8 steps - Adds
coalesce_resultandcoalesce_maybeconverters
- Fixes that code inside
.fixand.rescueofMaybemight be called twice
- Now all methods have doctests
- Updates docs about
Successand_Success,Failureand_Failure - Updates docs about
@pipeline - Typechecks async functions and decorators inside
typesafety/tests
- Breaking:
python>=3.7,<=3.7.2are not supported anymore, because of a bug insidetypingmodule - Breaking: Now
binddoes not change the type of an error - Breaking: Now
rescuedoes not change the type of a value - Breaking: Renames
map_failuretoalt - Adds
box()function with the ability to box function for direct container composition like:a -> Container[b]toContainer[a] -> Container[b] - Adds
IO.lift()function to lifta -> atoIO[a] -> IO[a] - Adds
pipe()function topipeline.py - Adds
__hash__()magic methods to all containers
- Changes
AnytoNoReturninSuccessandFailure - Now all type parameters in
Result,Maybe, andIOare covariant
- Massive docs rewrite
- Updates
mypyversion - Updates
wemake-python-styleguideand introducesnitpick - Updates
pytest-plugin-mypy, all tests now useyml
- Provides a bunch of primitive interfaces to write your own containers
- Adds
.map_failure()method - Adds
flatten()function to join nested containers
- Fixes type of
Maybe.fixandMaybe.rescueto work with bothlambda: 1andlambda _: 1
- Improves
README
- Reintroduces the
Maybecontainer, typed! - Introduces converters from one type to another
- Adds
mypyplugin to type decorators - Complete rewrite of
Resulttypes - Partial API change, now
SuccessandFailureare not types, but functions - New internal types introduced:
FixableContainerandValueUnwrapContainer
- Fixes issue when you could return
IOcontainer fromResult.bind - Fixes
@pipelinereturn type
- Reapplied all types to
.pyfiles - Improved docs about
IOandContainerconcept - Adds docs about container composition
- Moves from
AlphatoBeta
- Adds
IOcontainer - Adds
unsafemodule with unsafe functions - Changes how functions are located inside the project
- Fixes container type in
@pipeline - Now
is_successfulis public - Now
raise_exceptionis public
- Changes how
str()function works for container types - Total rename to "container" in the source code
safeandpipelinenow supportsasynciois_successfulnow returnsLiteraltypes if possible
- Adds
composehelper function - Adds public API to
import returns - Adds
raise_exceptionhelper function - Adds full traceback to
.unwrap()
- Updates multiple dev-dependencies, including
mypy - Now search in the docs is working again
- Relicenses this project to
BSD - Fixes copyright notice in the docs
- Moves all types to
.pyifiles - Renames all classes according to new naming pattern
- HUGE improvement of types
- Renames
fmaptomap - Renames
do_notationtopipeline, moves it tofunctions.py - Renames
ebindtorescue - Renames
efmaptofix - Renames
containertoContainer - Removes
Maybecontainer, since typing does not haveNonNullabletype
- Adds
py.typedfile to bePEP561compatible
The project is renamed to returns and moved to dry-python org.
- Adds
.pyifiles for all modules, to enablemypysupport for 3rd party users
- Adds
Maybecontainer - Adds immutability and
__slots__to all containers - Adds methods to work with failures
- Adds
safedecorator to convert exceptions toResultcontainer - Adds
is_successful()function to detect if your result is a success - Adds
failure()method to unwrap values from failed containers
- Changes the type of
.bindmethod forSuccesscontainer - Changes how equality works, so now
Failure(1) != Success(1) - Changes how new instances created on unused methods
- Improves docs
- Changes how
PyPIrenders package's page
- Improves
READMEwith new badges and installation steps
Initial release. Featuring only Result and do_notation.