Metadata-Version: 2.4
Name: grapes
Version: 0.10.4
Summary: Helper for dataflow based programming
Project-URL: Homepage, https://github.com/giuliofoletto/grapes
Author-email: Giulio Foletto <giulio.foletto@outlook.com>
License-Expression: Apache-2.0
License-File: LICENSE.txt
License-File: NOTICE.txt
Requires-Dist: matplotlib
Requires-Dist: networkx
Requires-Dist: pygraphviz
Requires-Dist: tomli; python_version < '3.11'
Provides-Extra: testing
Requires-Dist: pytest; extra == 'testing'
Description-Content-Type: text/markdown

# grapes

A simple library for dataflow programming in python.
It allows you to organize your computation as a directed acyclic graph.

## Quickstart

For a more detailed explanation, refer to the [documentation](https://giuliofolettograpes.readthedocs.io/).
Here's what you need to know to get started quickly.

Install `grapes` from PyPI with

```console
pip install grapes
```

Define a graph by adding steps and binding functions to them:

```python
import grapes as gr
g = gr.Graph()
gr.add_step(g, "b", "compute_b", "a")
gr.add_step(g, "c", "compute_c", "b")
gr.update_internal_context(g,
    {
        "compute_b": lambda a: 2*a,
        "compute_c": lambda b: b+1
    }
)
gr.finalize_definition(g)
```

Execute the graph to find your target, starting from your input context.

```python
context = {"a": 3}
target = "c"
result = gr.execute_graph_from_context(g, context, target)
print(result["c"])  # 7
```

## Additional remarks

The bulk of `grapes` development was done by Giulio Foletto in his spare time.
See `LICENSE.txt` and `NOTICE.txt` for details on how `grapes` is distributed.

`grapes` is inspired by [`pythonflow`](https://github.com/spotify/pythonflow) but with substantial modifications.

It relies internally on [`networkx`](https://networkx.org/) for graph management and on [`pygraphviz`](https://github.com/pygraphviz/pygraphviz) for graph visualization.

Most of the development of `grapes` was done before AI coding tools were available.
However, recent edits (September 2025) were assisted by GitHub Copilot, especially for writing docstrings.
