Skip to main content

Helper for dataflow based programming

Project description

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. Here's what you need to know to get started quickly.

Install grapes from PyPI with

pip install grapes

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

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.

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 but with substantial modifications.

It relies internally on networkx for graph management and on 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.

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

grapes-0.10.4.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grapes-0.10.4-py2.py3-none-any.whl (30.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file grapes-0.10.4.tar.gz.

File metadata

  • Download URL: grapes-0.10.4.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for grapes-0.10.4.tar.gz
Algorithm Hash digest
SHA256 2c71678e7d7eb98e31483202dac838e5567c2f8d77183339caa90b8966a13aff
MD5 545f7ebd4e94a5f657b5fb2366ce3ea4
BLAKE2b-256 cce2397ffd82f4e95df7d3e9e1eec237184fdd7a32e7be91e9cdb46fc1b09dae

See more details on using hashes here.

File details

Details for the file grapes-0.10.4-py2.py3-none-any.whl.

File metadata

  • Download URL: grapes-0.10.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for grapes-0.10.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e317f11d2448fe5ab352aca98dd2a1996c5481ec61da918149b9d1a34e514ca6
MD5 39e1401a19af162fa6a8fe0df6ebd41e
BLAKE2b-256 8edc1be739301742e741a687ecd88ba75e8216c5ba81f61658653a705032c97d

See more details on using hashes here.

Supported by

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