Version history¶
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.
0.27.0¶
Features¶
Drop
python3.10supportAdd
python3.14supportAdd
mypy>=1.19,<1.21support
0.26.0¶
Features¶
Added
mypy>=1.16,<1.18supportAdded
__bool__toMaybe, onlyNothingever returnsFalse
0.25.0¶
Features¶
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
Bugfixes¶
Fixes that
UnwrapFailedErrorwas not picklable
0.24.0¶
Features¶
Drop
python3.9supportAdd
python3.13supportAdd support for
mypy>=1.12Add picky exceptions to
future_safedecorator likesafehasImprove inference of
ResultLikeobjects when exception catching decorator is applied with explicit exception typesAdd picky exceptions to
impure_safedecorator likesafehas. Issue #1543Add partition function to result module. Issue #1905
Add
default_errorparameter toreturns.converters.maybe_to_result, which provides a default error value forFailure
0.24.1¶
Features¶
Make
hypothesisplugin test laws from user-defined interfaces tooMake
hypothesisplugin accept user-defined strategiesAllow users to override the
hypothesisplugin’s strategies for types, such asTypeVarandCallable.
Bugfixes¶
Add pickling support for
UnwrapFailedErrorexception
0.23.0¶
Features¶
Breaking: Remove
success_typeandfailure_typefields fromIOResult,MaybeandResulttypes
Misc¶
Now requires
mypy>=1.10Adds
[check-laws]extra for installation
0.22.0¶
Features¶
Breaking: Drops
python3.7supportNow requires
mypy>=1.5Adds
trampolinessupport
0.21.0¶
Features¶
Now requires
mypy>=1.4Adds
[compatible-mypy]extra for installation
0.20.1¶
Bugfixes¶
Fixed HKT
to_strexample in documentationFixed backward deserialization compatibility for BaseContainer
0.20.0¶
Features¶
Now requires
mypy>=1.2
Bugfixes¶
Fixes a problem with
do-notationand type aliasesFixes custom pickle protocol to handle
Nonevalues gracefullyRemoves broken drylabs.io link in README
Revises pointfree documentation
0.19.0 aka The Do Notation¶
Features¶
Adds
donotationAdds
attemptdecorator
Misc¶
Check
__slots__correctness withslotscheck
0.18.0¶
New Year Release! 🎄
Features¶
Now requires
typing_extensions>=4.0Now requires
mypy>=0.930Removes plugin for
@safe,@maybe,@future, etc. Because we now useParamSpectype to properly type decorators
Bugfixes¶
Fixes
__slots__not being set properly in containers and their base classesFixes patching of containers in pytest plugin not undone after each test
0.17.0¶
Features¶
Enables Pattern Matching support for
ResultcontainersEnables Pattern Matching support for
MaybecontainerEnables Pattern Matching support for
IOResultcontainerImproves
hypothesisplugin, now we detect when type cannot be constructed and give a clear error messageAdds the option to pass what exceptions
@safewill handle
0.16.0¶
Features¶
Makes
_Nothinga singletonRefactor
flowfunction to be faster
Bugfixes¶
Fixes that
assert_tracewas not catching containers from@safe-wrapped functions
Misc¶
Fixes typos in documentation
0.15.0 aka The initial HKT release¶
Features¶
Adds Higher Kinded Types partial support
Breaking: drops
python3.6supportBreaking: 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 rulesBreaking: renames
.rescueto.lashBreaking: removes all old interfaces from
primitives/interfaces.py, use new typeclasses insteadBreaking:
Maybeis fully reworked to be lawfulBreaking: removes
value_orpointfree method, because it is impossible to express with HKTBreaking: 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 exceptionBreaking: changes how
is_successfulis typed: now we allow anyUnwrappableinterface instances there, including custom onesBreaking: changes
UnwrapFailedErrorconstructor, now it does accept anUnwrappableinstance instead of aBaseContainerBreaking: removes
.fixmethod from all containers, also removesfixpointfree functionBreaking: Removes
coalescefunction, because it is impossible to properly type itBreaking: Removes all
Context*based types with.ask()method, use new.ask()methods on theReader-based containersBreaking: Now
FutureandFutureResultcan be awaited multiple timesBreaking: Removes
.unify()method from several containers, useunify()pointfree function insteadBreaking: Removes
.from_iterablemethod from all containers, instead adds betteriterablessupport, we now havereturns.iterablesmodule withFoldhelperBreaking: Renames property
emptytono_argsof allRequiresContext-based classesAdds new public interfaces: see
returns.interfacesAdds
methodspackage with several helpful things insideAdds
FutureSuccessandFutureFailureunit functions to be similar toResultandIOResultAdds
.swapmethod toResult,IOResult,FutureResult, and other result based containersAdds
.modify_envmethod to allRequiresContext*typesAdds
.rescuetoMaybeAdds
.equalsmethods to types that can be compared directly:Result,Maybe,IO,IOResultAdds missing
from_requires_context_future_resulttoRequiresContextAdds
.from_optionaland.bind_optionaltoMaybecontainerAdds
__slots__toUnwrapFailedErrorwithhalted_containerChanges
flattento work withKindNand any possible containerAdds a helper to test traces to our
pytestpluginAdds
condfunction topointfreeandmethodspackagesAdds
compose_resultHKT method and pointfree functionAdds
unifyHKT pointfree functionAdds
bimappointfree functionAdds
unwrap_or_failurefunction tomethodspackageAdds
collect_tracehelper function for better development experienceAdds
hypothesisintegration and pre-defined “monad laws as values”Adds
assert_equalmethod to ourpytestplugin
Bugfixes¶
Breaking: fixes serious typing issue and changes how
flowworksBreaking: fixes serious typing issue and changes how
pipeworks, now it has a hard limit of 20 parametersFixes that
RequiresContextFutureResultwas not supported bypytestpluginFixes incorrect
partialbehaviour in an edge case, #618Fixes 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
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, andMethodspagesChanged
__str__method inBaseContainerclass to__repr__methodAdds
Quickstartguide
0.14.0¶
Features¶
Breaking: renames mypy plugin from
decorator_plugintoreturns_pluginbecause of a complete rewrite and lots of new featuresBreaking: changes
@safe,@impure,impure_safe,@maybesemantics: they do not work withasyncfunctions anymore; now you are forced to useFutureand its helpers to work withasyncfunctionsBreaking: 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 methodsBreaking: renames
.from_successful_io()to.from_io(), there’s no need in two separate methodsBreaking: renames
.from_successful_context()to.from_context(), there’s no need in two separate methodsBreaking: since we now support
.apply()method, there’s no more need in*_squashconverters, they are removedBreaking: renamed
InstanceabletoApplicativeBreaking: changes
.from_ioand.from_failed_ioofIOResultto returnAnyinstead ofNoReturnunfilled typeBreaking: removes
.liftand.lift_*methods from all containers, usemap_,bind_result,bind_io, and other pointfree helpers insteadBreaking: 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. UseflowinsteadAdds typed
partialandcurrymypy plugins!Adds typed
flowplugin, now it can accept any number of arguments, it now also has excellent type inferenceAdds typed
pipeplugin, now it can accept any number of arguments, it now also has good type inferenceAdds
managedpipeline function that is useful for working with stateful computationsAdds typed
map_,fix, andaltpointfree functionsAdds typed
bind_result,bind_io,bind_ioresult,bind_context,bind_context_result,bind_future,bind_async, andbind_awaitablepointfree functionsAdds typed
bind_async_futureandbind_async_future_resultpointfree functionsAdds typed
unifypointfree functionAdds typed
applypointfree functionAdds typed
value_orpointfree functionAdds
pytestplugin with the ability to tests error handlingAdds
Futurecontainer to easily work withasyncfunctionsAdds
FutureResultcontainer to easily work withasyncfunction that might failAdds
RequiresContextFutureResultcontainerAdds
ReaderFutureResultalias forRequiresContextFutureResultAdds
RequiresContextFutureResultEandReaderFutureResultEaliasesAdds
Future,FutureResultandRequiresContextFutureResultsupport for all existing pointfree functionsAdds
bind_iomethod toIOResultAdds
bind_iomethod toRequiresContextIOResultAdds
or_elsemethod toMaybeAdds
.from_ioand.from_failed_iotoRequiresContextIOResultSyncs naming in
from_*methods, now all parameters are namedinner_valueAdds
not_composition helperAdds
flattensupport forFuture,FutureResultandRequiresContextFutureResultAdds
__copy__and__deepcopy__magic methods toImmutableclassSpeeds up
is_successfulfunctionMakes all
Contextcontext helpers abstract, so you cannot create new instances of this class, also adds__slots__to these classesImproves
RequiresContext*types withNoDepswhere it is logically true
Bugfixes¶
Fixes that
@safedecorator was generating incorrect signatures for functions withAnyFixes that
.rescue()ofRequiresContextResultwas returningAnyFixes that
.rescue()ofRequiresContextIOResultwas returningAnyFixes that
RequiresContextResultandRequiresContextIOResultwere notfinalFixes that
ImmutableStateErrorwas not a subclass ofAttributeErrorFixes that
IOResultwas not showingstrrepresentation of wrappedinner_value
Misc¶
Replaces
pytest-asynciowithanyioplugin, now we test compatibility with any IO stack:asyncio,trio,curioUpdates 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?
0.13.0¶
Features¶
Breaking: renames
jointoflatten, sorry!Breaking: renames
boxtobindand moves it toreturns.pointfreeBreaking: removes
Maybe.rescueandMaybe.fixmethodsBreaking: renames
io_squashtosquash_ioand moves it toreturns.convertersBreaking: moves all interfaces from
returns.primitives.containertoreturns.primitives.interfacesAdds
rescuepointfree functionAdds
ResultEalias forResult[..., Exception]Adds
RequiresContextcontainer andContexthelper classAdds
RequiresContextsupport forbindpointfree functionAdds
RequiresContextsupport forflattenfunctionAdds
RequiresContextResultcontainerAdds
RequiresContextResultEaliasAdds
ReaderResultandReaderResultEaliases forRequiresContextResult[..., ..., Exception]Adds
RequiresContextResultsupport forbindandrescueAdds
RequiresContextResultsupport forflattenAdds
IOResulthelper to work better withIO[Result[a, b]]Adds
IOResultEalias forIOResult[a, Exception]Adds
IOResultsupport forbindAdds
IOResultsupport forflattenAdds
IOResultsupport for@pipelineAdds
IOResultsupport forcoalesceAdds
IOResultsupport foris_successfulAdds
RequiresContextIOResultcontainerAdds
RequiresContextIOResultEaliasAdds
ReaderIOResultandReaderIOResultEaliases forRequiresContextIOResult[..., ..., Exception]Adds
RequiresContextIOResultsupport forbindandrescueAdds
RequiresContextIOResultsupport forflattenAdds
Result.lift,Maybe.lift,RequiresContext.lift, andRequiresContextResult.liftfunctions in addition toIO.liftAdds
Immutableprimitive typeAdds
Unitableprotocol and.from_success()and.from_failure()methods for allResultrelated classesAdds
Instanceableprotocol and.from_value()method forIOandRequiresContextAdds
flowfunction, which is similar topipeAdds
swapconverter forResultandIOResultAdds
squash_contextfunction to squashRequiresContextsimilar toIO
Bugfixes¶
Now
SuccessandFailure(bothioand pure) returnAnyand notNoReturnFixes how
flattenworks, also adds more tests and docs aboutFailurecaseFixes
Unwrappabletype being parametrized with only oneTypeVarChanges
SuccessandFailureto returnAnyinstead ofNoReturn
Misc¶
Updates
poetryversion intravisImproves
pipedocs withlambdaandGenericproblemImproves docs in several places
Now examples in docs tries to be docstests where possible
Changes how tests are checked with
mypyin CI
0.12.0¶
Features¶
Breaking: now
@pipelinerequires a container type when created:@pipeline(Result)or@pipeline(Maybe)MaybeandResultnow hassuccess_typeandfailure_typealiasesAdds
Result.unifyutility method for better error type compositionWe now support
dry-python/classesas a first-class citizenAdds
io_squashto squash severalIOcontainers into one container with a tuple inside, currently works with9containers max at a timeAdds
untapfunction which does convert return type toNone
Bugfixes¶
Fixes that containers were not usable with
multiprocessingChanges the inheritance order, now
BaseContaineris the first childFixes that
Nothinghad incorrect docstrings
Misc¶
Now
generatedpackage is protectedUpdates
poetryto1.0
0.11.0¶
Features¶
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 stuffBreaking: dropped support of zero argument functions for
Nothing.fixBreaking: dropped support of zero argument functions for
Nothing.rescueMaybenow has.failure()to match the same API asResultAdds
identityfunctionAdds
tapfunctionNow
pipeallows to pipe 8 stepsAdds
coalesce_resultandcoalesce_maybeconverters
Bugfixes¶
Fixes that code inside
.fixand.rescueofMaybemight be called twice
Misc¶
Now all methods have doctests
Updates docs about
Successand_Success,Failureand_FailureUpdates docs about
@pipelineTypechecks async functions and decorators inside
typesafety/tests
0.10.0¶
Features¶
Breaking:
python>=3.7,<=3.7.2are not supported anymore, because of a bug insidetypingmoduleBreaking: Now
binddoes not change the type of an errorBreaking: Now
rescuedoes not change the type of a valueBreaking: Renames
map_failuretoaltAdds
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.pyAdds
__hash__()magic methods to all containers
Bugfixes¶
Changes
AnytoNoReturninSuccessandFailureNow all type parameters in
Result,Maybe, andIOare covariant
Misc¶
Massive docs rewrite
Updates
mypyversionUpdates
wemake-python-styleguideand introducesnitpickUpdates
pytest-plugin-mypy, all tests now useyml
0.9.0¶
Features¶
Provides a bunch of primitive interfaces to write your own containers
Adds
.map_failure()methodAdds
flatten()function to join nested containers
Bugfixes¶
Fixes type of
Maybe.fixandMaybe.rescueto work with bothlambda: 1andlambda _: 1
Misc¶
Improves
README
0.8.0¶
Features¶
Reintroduces the
Maybecontainer, typed!Introduces converters from one type to another
Adds
mypyplugin to type decoratorsComplete rewrite of
ResulttypesPartial API change, now
SuccessandFailureare not types, but functionsNew internal types introduced:
FixableContainerandValueUnwrapContainer
Bugfixes¶
Fixes issue when you could return
IOcontainer fromResult.bindFixes
@pipelinereturn type
Misc¶
Reapplied all types to
.pyfilesImproved docs about
IOandContainerconceptAdds docs about container composition
Moves from
AlphatoBeta
0.7.0¶
Features¶
Adds
IOcontainerAdds
unsafemodule with unsafe functionsChanges how functions are located inside the project
Bugfixes¶
Fixes container type in
@pipelineNow
is_successfulis publicNow
raise_exceptionis public
Misc¶
Changes how
str()function works for container typesTotal rename to “container” in the source code
Version 0.6.0¶
Features¶
safeandpipelinenow supportsasynciois_successfulnow returnsLiteraltypes if possible
Version 0.5.0¶
Features¶
Adds
composehelper functionAdds public API to
import returnsAdds
raise_exceptionhelper functionAdds full traceback to
.unwrap()
Misc¶
Updates multiple dev-dependencies, including
mypyNow search in the docs is working again
Relicenses this project to
BSDFixes copyright notice in the docs
Version 0.4.0 aka Goodbye, containers!¶
Features¶
Moves all types to
.pyifilesRenames all classes according to new naming pattern
HUGE improvement of types
Renames
fmaptomapRenames
do_notationtopipeline, moves it tofunctions.pyRenames
ebindtorescueRenames
efmaptofixRenames
containertoContainerRemoves
Maybecontainer, since typing does not haveNonNullabletype
Version 0.3.1¶
Bugfixes¶
Adds
py.typedfile to bePEP561compatible
Version 0.3.0, Renamed to returns¶
The project is renamed to returns and moved to dry-python org.
Features¶
Adds
.pyifiles for all modules, to enablemypysupport for 3rd party users
Version 0.2.0¶
Features¶
Adds
MaybecontainerAdds immutability and
__slots__to all containersAdds methods to work with failures
Adds
safedecorator to convert exceptions toResultcontainerAdds
is_successful()function to detect if your result is a successAdds
failure()method to unwrap values from failed containers
Bugfixes¶
Changes the type of
.bindmethod forSuccesscontainerChanges how equality works, so now
Failure(1) != Success(1)Changes how new instances created on unused methods
Misc¶
Improves docs
Version 0.1.1¶
Bugfixes¶
Changes how
PyPIrenders package’s page
Misc¶
Improves
READMEwith new badges and installation steps
Version 0.1.0¶
Initial release. Featuring only Result and do_notation.