Coder Social home page Coder Social logo

mcminis1 / mr-graph Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 0.0 82 KB

a graph definition and execution library for python

Home Page: https://mr-graph.readthedocs.io/en/latest/index.html

License: MIT License

Python 99.49% Shell 0.51%
asyncio graphs python

mr-graph's Introduction

Mr. Graph

Documentation Status

Welcome to Mr. Graph!

Mr. Graph is a python library designed to make composing graphs of sync and async functions easy! Use google style docstrings to automagically create dataclasses and chain together function calls into graphs.

Features

  • Use with either async or sync functions
  • Uses google style doc strings to name return values.
  • Creates dataclasses for each function's output.
  • Can infer pipelines from input and output signatures
  • All directed acyclic graph layouts supported. linear, fan-in, fan-out.

Example Usage

Building graphs can be as easy as:

from mr_graph import Graph

def return_one():
    """
    return 1

    return one with no inputs

    Returns
    -------
    m : float
        equal to 1
    """
    return 1
    
async def add_1(m: float):
    """
    add 1 to a number

    add 1 to the input value n.

    Parameters
    ----------
    n : float
        number to add 1 to.

    Returns
    -------
    n : float
        equal to n + 1
    """
    return n + 1

async def build_implicit_linear_graph():
    """
    Return 2

    Simple example linear graph. Wired up automagically using the input and output variable names.

    Parameters
    ----------
    
    Returns
    -------
    two : float
        always equal to 2
    """

    g = Graph(nodes=[return_one, add_1])
    return await g()

More information can be found on read the docs!

mr-graph's People

Contributors

mcminis1 avatar

Stargazers

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

Watchers

 avatar  avatar

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.