# Mr. Graph
[![Documentation Status](https://readthedocs.org/projects/mr-graph/badge/?version=latest)](https://mr-graph.readthedocs.io/en/latest/?badge=latest)
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:
```python
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!
Raw data
{
"_id": null,
"home_page": "https://mr-graph.readthedocs.io/en/latest/",
"name": "mr-graph",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "graph,mr_graph",
"author": "Jeremy McMinis",
"author_email": "jeremy@sawtoothdata.com",
"download_url": "https://files.pythonhosted.org/packages/92/fa/bc17d9d6351bf51d92d4abf9d24268f5c8eca305646d75588692e450e055/mr_graph-0.2.6.tar.gz",
"platform": null,
"description": "# Mr. Graph\n\n[![Documentation Status](https://readthedocs.org/projects/mr-graph/badge/?version=latest)](https://mr-graph.readthedocs.io/en/latest/?badge=latest)\n\nWelcome to Mr. Graph!\n\nMr. 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.\n\n## Features\n\n- Use with either async or sync functions\n- Uses google style doc strings to name return values.\n- Creates dataclasses for each function's output.\n- Can infer pipelines from input and output signatures\n- All directed acyclic graph layouts supported. linear, fan-in, fan-out.\n\n\n## Example Usage\n\nBuilding graphs can be as easy as:\n\n```python\nfrom mr_graph import Graph\n\ndef return_one():\n \"\"\"\n return 1\n\n return one with no inputs\n\n Returns\n -------\n m : float\n equal to 1\n \"\"\"\n return 1\n \nasync def add_1(m: float):\n \"\"\"\n add 1 to a number\n\n add 1 to the input value n.\n\n Parameters\n ----------\n n : float\n number to add 1 to.\n\n Returns\n -------\n n : float\n equal to n + 1\n \"\"\"\n return n + 1\n\nasync def build_implicit_linear_graph():\n \"\"\"\n Return 2\n\n Simple example linear graph. Wired up automagically using the input and output variable names.\n\n Parameters\n ----------\n \n Returns\n -------\n two : float\n always equal to 2\n \"\"\"\n\n g = Graph(nodes=[return_one, add_1])\n return await g()\n```\n\nMore information can be found on read the docs!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A graph definition execution library for async/sync python functions.",
"version": "0.2.6",
"split_keywords": [
"graph",
"mr_graph"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7853f8b827f203d948a9319483e1679fc654b9d2db8e62f8b2a8d659a42f57c6",
"md5": "b387776e0369976ef813e79af0e1b1be",
"sha256": "8955e9f7dbf67415e1bdfeebabef0a6370edaa74ba2123833bd417f38a8d9685"
},
"downloads": -1,
"filename": "mr_graph-0.2.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b387776e0369976ef813e79af0e1b1be",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 12108,
"upload_time": "2023-03-22T19:14:26",
"upload_time_iso_8601": "2023-03-22T19:14:26.896855Z",
"url": "https://files.pythonhosted.org/packages/78/53/f8b827f203d948a9319483e1679fc654b9d2db8e62f8b2a8d659a42f57c6/mr_graph-0.2.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "92fabc17d9d6351bf51d92d4abf9d24268f5c8eca305646d75588692e450e055",
"md5": "0168e88099b02406ec60b56c176da8d3",
"sha256": "194f0a12236345e255c251013fd16569f2200e1218556f3b1c8ec03b30ebf8d0"
},
"downloads": -1,
"filename": "mr_graph-0.2.6.tar.gz",
"has_sig": false,
"md5_digest": "0168e88099b02406ec60b56c176da8d3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12302,
"upload_time": "2023-03-22T19:14:28",
"upload_time_iso_8601": "2023-03-22T19:14:28.024934Z",
"url": "https://files.pythonhosted.org/packages/92/fa/bc17d9d6351bf51d92d4abf9d24268f5c8eca305646d75588692e450e055/mr_graph-0.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-22 19:14:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "mr-graph"
}