Skip to main content

Python in a Graph

Why?

My (author) motivation is to be able to generally describe systems that respond to change.

Related (but not the same):

  • reactive programming libraries: Doesn't focus on a 'state'
  • dynamical systems pathsim: This library doesn't, at the face of it, look like it can do what pathsim does, but I think sim descriptions could be mapped somehow.

DAG exec:

  • pipefunc state with no deps. useful as is but you can farm out tasks as you wish.

How?

Rules/functions are repeatedly applied to a 'state' (dict) until there are no more changes. w

1. Specify

Rules initializer:

def __init__(self, state: state = {}, *, log: bool = False): ...

Function registration:

def register(self, argmap: argmap = {}): ...
import state_rules.main as rm

r = rm.Rules({'x':1}, log=True)
@r.register({
    # input
    'x': 'x' # created by default from func sig if not specified
    # output
    'return': 'x', # default is funcname.
    # for multiple outputs,
    # can be a dict that updates state: return: { }
     })
def f(x):
    return x+x # {'x': x+x, 'x+x':x+x } # will be inserted to state

2. Run

The run function signature:

def run(self, maxiter=10, *, stopping: Callable[[state], bool] | None = None): ...
r.run(5)
r.log
[
Iteration(i=0, state={'x': 1})
Iteration(i=1, state={'x': 2})
Iteration(i=2, state={'x': 4})
Iteration(i=3, state={'x': 8})
Iteration(i=4, state={'x': 16})
Iteration(i=5, state={'x': 32})
]

Tips

  • The state is a (flat) dictionary but you can use a fancy dotted dict if you want more structure. Then, use use a function to get at a key.
  • Cache function calls (yourself) as functions will get repeatedly called with the same input.
  • Use stopping critereon to early stop before maxiter.

Release files for pyigr 2026.9.114

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyigr 2026.9.114
File Size Uploaded
pyigr-2026.9.114.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyigr 2026.9.114
File Interpreter ABI Platform
pyigr-2026.9.114-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / pyigr-2026.9.114.tar.gz

Download URL pyigr-2026.9.114.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
87953485029aa87176f417bee3fa4ab5050027ba7085e278a8464a9b8d4484df
BLAKE2b-256 checksum
How to use checksums
9cbdef786d379c815b3d858735fb7275bc415c2b4f762dc97297d2da467486ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / pyigr-2026.9.114-py3-none-any.whl

Download URL pyigr-2026.9.114-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fd2b230ec5be2a839f8af22098957ab0688879be4544aba42c359b090d5c656
BLAKE2b-256 checksum
How to use checksums
98f68ae5f4da68c40813ff4d61992530bc38ca0780ad66fb2aab756a913d42e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.9.114 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page