Skip to main content

pypagate

pypagate

GitHub Actions Workflow Status PyPI Python Version

A dead simple reactive library based on mathematical formulae.

Quick Install

If you use pip:

pip install pypagate

If you use uv:

uv add pypagate

What is pypagate?

Imagine you are working in a spreadsheet editor such as Excel. You write in a bunch of test scores and then use a formula to calculate the average of all the students. You mistakenly gave one student the wrong score. No worries, you update the score and the average is magically updated.

Now, imagine you are working with Python to do the same thing. You input the student scores in a list and calculate the mean:

>>> from statistics import mean
>>> scores = [80, 85, 95, 100]
>>> mean(scores)
90

You then realized you need to update the score of one student, so you change the corresponding entry in scores but unlike the Excel scenario, the mean is not magically updated. Sure, you could call mean again and recalculate the new scores, but would it not be cool if you just had a variable that always updated accordingly?

Enter formulae

The core idea in this library is that the cells in Excel which contain data we manually update, and there are cells in Excel which update based on data. The cells we manually update we refer to as Terms and the cells that automatically update are referred to as Formulas.

Let us look at a small example:

>>> from pypagate import Term
>>> x = Term(5)
>>> y = x + 1
>>> print(x.unwrap()) # (Call unwrap to get the value x currently stores)
5
>>> print(y.unwrap())
6
>>> x += 1
>>> print(y.unwrap())
7

y magically changed even though we never touched it.

But wait, there's more!

An event listener is a construct that waits for an event to happen and then executes some code when the event does happen. pypagate gives an elegant way to make new event listeners and organize your code.

Consider we have a player object that has some health:

>>> from pypagate import Term, fire_on
>>> class Player:
...     def __init__(self, health):
...         self.health = Term(health)
...
>>> player = Player(3)
>>> @fire_on(player.health == 0)
>>> def game_over():
...     print("Game over")
>>> player.health -= 1
>>> player.health -= 1
>>> player.health -= 1
Game over

The fire_on decorator waits for a formula to evaluate to True and then fires the corresponding function. Now, we can compose sophisticated event listeners using simple formula!

Documentation

Further documentation can be found on readthedocs.

Metadata

Release files for pypagate 0.4.3

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

Source distribution (sdist)

Source distribution for pypagate 0.4.3
File Size Uploaded Provenance Actions
pypagate-0.4.3.tar.gz 9.0 kB With provenance Details for pypagate-0.4.3.tar.gz

Built distribution (wheel)

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

Total release size: 19.4 kB

Release files / pypagate-0.4.3.tar.gz

Download URL pypagate-0.4.3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f01edcb42635b90aabc2656cf096fb6d7aa95a5cbf08c549ea0a3a860e29f0fe
BLAKE2b-256 checksum
How to use checksums
a3822ceeb9ffdc165f5f019aaed449897174b99f9a20af6c5b564a01bc74414d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 27, 2026.

Transparency log

Release files / pypagate-0.4.3-py3-none-any.whl

Download URL pypagate-0.4.3-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d6937f9583e741331b33e19b68e3b9d6b029a7072cf81059cf0e0e29eb63f86
BLAKE2b-256 checksum
How to use checksums
c9c64d7ab7cb499a067a0df058b89aad1c6517b23cd2c53dc150751e5738fe10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 27, 2026.

Transparency log

Security for pypagate 0.4.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pypagate-0.4.3.tar.gz

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 Jul 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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