Skip to main content
phyelds logo

Phyelds

Lightweight, pythonic aggregate computing & field calculus toolkit for building, simulating, and experimenting with large scale distributed systems.

PyPI version Python versions Downloads Tests Coverage Docs
License Last commit semantic-release Conventional Commits

Documentation · Tutorial · Playground · API reference


You write one function for a whole collective (a swarm of robots, a sensor network, a fleet of devices) and every device runs it in rounds, exchanging values only with its neighbors. Global behaviour emerges from local state and local communication, and the library stays small enough to read in an afternoon.

A self-organizing channel between the bottom-left and top-right corners

Installation

pip install phyelds                         # core: the calculus and the libraries
pip install phyelds-simulator               # the simulator, with a compatible phyelds
pip install "phyelds-simulator[jupyter]"    # live rendering inside Jupyter
pip install phyelds-vmas                    # VMAS integration
pip install phyelds-mesa                    # Mesa integration
pip install phyelds-webots                  # Webots integration

Requires Python 3.12+.

A taste

A channel: the devices on a route from a source to a target at most width longer than the shortest one. A device is on such a route when its distance from the source plus its distance from the target is close to the distance between the two, so the channel is three gradients of the standard library, composed like ordinary Python functions:

from phyelds.calculus import aggregate
from phyelds.libraries.distances import neighbors_distances
from phyelds.libraries.spreading import distance_between, distance_to

@aggregate
def channel(source: bool, target: bool, width: float) -> bool:
    distances = neighbors_distances()
    to_source = distance_to(source, distances)
    to_target = distance_to(target, distances)
    between = distance_between(source, target, distances)
    return to_source + to_target <= between + width

Every device runs the same function, talking only to its neighbors, and the channel heals by itself when devices move or fail. The playground runs it in your browser, and the tutorial builds the gradient beneath it step by step from remember and neighbors.

What's inside

  • Core primitives: @aggregate, remember, neighbors, exchange, align, and the NeighborhoodField abstraction with element-wise arithmetic.
  • Standard libraries: spreading, collection, gossip, leader election, time & reactive state, aggregate processes (@process / spawn), and spatial/temporal logic (SLCS & Past-CTL).
  • Simulator (phyelds-simulator): a pluggable discrete-event simulator with live rendering, animation export, and VMAS integration (phyelds-vmas).
  • Mesa (phyelds-mesa): phyelds programs on the agents of a Mesa model.
  • Webots (phyelds-webots): phyelds programs on the robots of a Webots simulation, talking over their simulated radios.
  • MicroPython: the same programs run on microcontrollers such as the ESP32 (python -m phyelds.micropython), and talk with devices running CPython.
  • Experimental (phyelds.experimental): studies in progress, whose API will probably change, such as collective state machines.

Everything is explained in the documentation: thinking in fields, core concepts, libraries, simulator, integration with other runtimes, MicroPython and the ESP32, experimental studies, and common pitfalls.

Phyelds stands on the shoulders of over a decade of research and open-source tools in spatial and aggregate computing, bringing their ideas into a lightweight, Python-native library designed to integrate naturally with Python's scientific, simulation, and machine-learning ecosystem:

  • Proto & Protelis (GitHub) — The pioneering spatial computing and aggregate programming languages that established the computational field abstraction, the rep / nbr (remember / neighbors) round-based execution model, and the self-organizing coordination building blocks.
  • ScaFi (GitHub) — The Scala toolkit for aggregate programming, which inspired Phyelds's internal-DSL approach, standard coordination blocks (G/C/S, summarize, channel, reactive state and time operators), and spatially/temporally scoped aggregate processes (@process / spawn).
  • FCPP (GitHub) — The high-performance C++ field calculus library, from which Phyelds draws the exchange primitive (from Exchange Calculus), resilient coordination strategies (path-coherent gradients, multi-path and point-to-point collection, bounded leader election), and spatial/temporal logic operators (SLCS and Past-CTL).
  • Collektive — The Kotlin Multiplatform aggregate computing DSL, which influenced Phyelds's ergonomic NeighborhoodField API and automatic alignment of standard language control flow (if/else AST rewriting via @aggregate).

For the ideas behind the paradigm, see the main paper on aggregate computing.

Development

git clone https://github.com/phyelds/phyelds.git
cd phyelds
poetry install
poetry run pytest
poetry run pylint src/
poetry run flake8

Contributions are welcome: open an issue for non-trivial changes, keep PRs focused and tested, and use Conventional Commits, since releases are produced from the commit messages.

Contributors & Acknowledgments

Main Contributors

Acknowledgments

Special thanks to Mirko Viroli, Ferruccio Damiani, Danilo Pianini, Roberto Casadei, and Giorgio Audrito for the insightful discussions, foundational ideas, and continuous feedback that made this project possible.

License

Apache License 2.0 – see LICENSE.

Metadata

Release files for phyelds 8.4.1

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

Source distribution (sdist)

Source distribution for phyelds 8.4.1
File Size Uploaded Provenance
phyelds-8.4.1.tar.gz 55.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 123.5 kB

Release files / phyelds-8.4.1.tar.gz

Download URL phyelds-8.4.1.tar.gz
Size 55.9 kB
Tags Source
SHA-256 checksum
How to use checksums
059bc3853a6477a8552df6e8bccd2e24d9e4e2c5b4cf28849b54999de8c0229e
BLAKE2b-256 checksum
How to use checksums
2216f2d1d3be3b4a1330d1b6c098d5c76eaef01162e673f60057032e8c47fdcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.13.16 Linux/6.17.0-1022-azure

Release files / phyelds-8.4.1-py3-none-any.whl

Download URL phyelds-8.4.1-py3-none-any.whl
Size 67.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04a9da677f88fa10989f07e0c282c628c859e54abe5d0991ac6a9ab903a71522
BLAKE2b-256 checksum
How to use checksums
c3906b1752c36c124a06db3b7541bfba9caf9c885889c68c4f47ee5466cf6fa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.13.16 Linux/6.17.0-1022-azure

Security for phyelds 8.4.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

8.4.1 This release

2 release files No provenance

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