Skip to main content

A graph definition execution library for async/sync python functions.

Project description

Mr. Graph

Welcome to Mr. Graph!

Mr. Graph is a python library designed to make composing graphs of sync and async functions easy!

Features

  • Use with either async or sync functions
  • Uses regular documentation formats to name return values.
  • 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 to be found soon on read the docs!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mr_graph-0.1.1.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

mr_graph-0.1.1-py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page