vickumar1981 / pyeffects Goto Github PK
View Code? Open in Web Editor NEWHandle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.
License: Other
Handle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.
License: Other
As part of: #34
The 3.11 build/test action was disabled in the github actions. Running 3.11, gives an error ModuleNotFoundError: No module named 'typing_extensions
.
Not sure what changed from the previous builds, particularly with the Pipfile
. The only change was to update flake8
to black
.
Enabling the 3.11 build in the github actions will run successfully.
Build complains that there is no module for typing-extensions
.
and the github action checks succeed for all the builds.
The current Future
implementation uses python's threading
library, to maintain backwards compatibility with Python 2.
If Python 2 is no longer supported, then the class can instead use asyncio
.
Add steps to run unit tests on python 3.7, and python 3.8 in the tox.ini
file, and in the travis build.
Add an on_success
callback to the Try
class, so that you can call a function w/o returning a value, when the Try
succeeds.
Case classes were implemented in macropy, but AFAIK, this library isn't supported and doesn't work on Python 3. There's a lot in macropy, but the case class functionality is great for saving on boiler plate code.
Most of the classes already have an __repr__
for printing/debugging, but should move this to a __str__
method and have the repr function just call the str function.
Add an on_success
subscriber method. Should work like on_complete
but only trigger the callback if the resulting Future
is successful.
Using type hinting, you can't specify the type parameter to any of the classes.
i.e.:
def find_person(id: int) -> Option:
# pass
will work, but
def find_person(id: int) -> Option[string]:
# doesn't work, should
will not work.
Expect to be able to pass the type parameters via type hinting. Python's Iterable
and List
do this, for example.
An exception is thrown: 'type' object is not subscriptable
import pyeffects.Option.*
def find_person(id: int) -> Option[string]:
pass
Macropy doesn't look like it is supported yet on Python 3. Would like to use the quick lambdas.
Now that we have on_success
and on_failure
working for Try
and Future
, we should add them to the Read the Docs.
https://github.com/vickumar1981/pyeffects/blob/master/docs/future.rst
https://github.com/vickumar1981/pyeffects/blob/master/docs/try.rst
All implemented classes need to have a dunder __eq__
method so that they can be compared for equality.
The project has recently switched to using Github actions over using Travis CI/CD: #22
We should add the step that generates the coverage report to the CI/CD for github actions and link the README to the test coverage results.
The command to generate a coverage.xml
is make coverage
, and you can also generate an HTML version using make coverhtml
.
The line in the README.md
should link to the coverage report for the master
branch:
[![Build Status](https://api.travis-ci.com/vickumar1981/pyeffects.svg?branch=master)]
Add classes for List
, Set
, and Map
that wrap the python built-in list
, set
, and dict
objects. Will extend the base Monad
object and support map
and flat_map
operations, as well as other basic operations that can be wrapped by just calling the built-in methods.
Add an on_failure
subscriber method for the Future
class. Should work like on_complete
but only trigger the callback if the resulting Future
has failed.
Add an on_success
callback to the Try
class, so that you can call a function w/o returning a value, when the Try
succeeds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.