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! 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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mr_graph-0.2.6.tar.gz.
File metadata
- Download URL: mr_graph-0.2.6.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
194f0a12236345e255c251013fd16569f2200e1218556f3b1c8ec03b30ebf8d0
|
|
| MD5 |
0168e88099b02406ec60b56c176da8d3
|
|
| BLAKE2b-256 |
92fabc17d9d6351bf51d92d4abf9d24268f5c8eca305646d75588692e450e055
|
File details
Details for the file mr_graph-0.2.6-py3-none-any.whl.
File metadata
- Download URL: mr_graph-0.2.6-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8955e9f7dbf67415e1bdfeebabef0a6370edaa74ba2123833bd417f38a8d9685
|
|
| MD5 |
b387776e0369976ef813e79af0e1b1be
|
|
| BLAKE2b-256 |
7853f8b827f203d948a9319483e1679fc654b9d2db8e62f8b2a8d659a42f57c6
|