Giter Site home page Giter Site logo

vickumar1981 / pyeffects Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 5.0 378 KB

Handle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.

License: Other

Python 97.21% Makefile 2.79%
python monad monads try option option-type future futures either either-monad

pyeffects's People

Contributors

battinisandeep avatar dependabot[bot] avatar sloboegen avatar vickumar1981 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyeffects's Issues

Error with CI/CD on Python 3.11

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.

Expected Result

Enabling the 3.11 build in the github actions will run successfully.

Actual Result

Build complains that there is no module for typing-extensions.

Reproduction Steps

and the github action checks succeed for all the builds.

Use asyncio instead of threading

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 .on_success to Future object

Add an on_success subscriber method. Should work like on_complete but only trigger the callback if the resulting Future is successful.

Compatibility with Type Hinting

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.

Expected Result

Expect to be able to pass the type parameters via type hinting. Python's Iterable and List do this, for example.

Actual Result

An exception is thrown: 'type' object is not subscriptable

Reproduction Steps

import pyeffects.Option.*

def find_person(id: int) -> Option[string]:
  pass

Add coverage report to CI/CD

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 a collections Api: List, Set, and Map

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.