Skip to main content

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.

How?

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

import state_rules.main as rm
r = rm.Rules({'x':1})
#
@r.register({'return': 'x', 'x': 'x' })
def f1(x):
    return x+x

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. In the example above: x -> lambda k: k=='x' or k.endswith('.x')
  • Cache function calls (yourself)
  • Define your notion of dictionary equality

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

state_rules-2026.8.37.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

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

state_rules-2026.8.37-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file state_rules-2026.8.37.tar.gz.

File metadata

  • Download URL: state_rules-2026.8.37.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for state_rules-2026.8.37.tar.gz
Algorithm Hash digest
SHA256 393acbb645aa660ef39c82b73df387b28b8cec6cfd5c7b8a84fb874e70a2500b
MD5 67d6db55a42837ef5c2f4c8f8c096836
BLAKE2b-256 748d388463d1fc008f9435957c4b4a802027fa23a5d463f91962c54020e1fe81

See more details on using hashes here.

Provenance

The following attestation bundles were made for state_rules-2026.8.37.tar.gz:

Publisher: python-publish.yaml on majidaldo/state-rules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file state_rules-2026.8.37-py3-none-any.whl.

File metadata

File hashes

Hashes for state_rules-2026.8.37-py3-none-any.whl
Algorithm Hash digest
SHA256 90f71f23b3b531afb1c3dac13a554dd93d3d084f26a17c0fe5a4c4d25096e9ae
MD5 d923e3dc8fc493aa3db8cee3919e6c74
BLAKE2b-256 25d4cc0477fdf7e07b98129b54dd2cbcf610c23e6c6c70f3364a033b9f5c5d6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for state_rules-2026.8.37-py3-none-any.whl:

Publisher: python-publish.yaml on majidaldo/state-rules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2026.9.50

2 files

2026.8.48

2 files

2026.8.43

2 files

This release

2026.8.37 This release

2 files

2026.3.35

2 files

2026.3.34

2 files

2026.3.33

2 files

2026.3.29

2 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