Phyelds
Lightweight, pythonic aggregate computing & field calculus toolkit for building, simulating, and experimenting with large scale distributed systems.
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.
Installation
pip install phyelds # core library and simulator
pip install "phyelds[jupyter]" # live rendering inside Jupyter
pip install phyelds-vmas # VMAS integration
Requires Python 3.12+.
A taste
A channel (or corridor): the devices within WIDTH of the shortest path between
a source and a target, as in the animation above. It is three building blocks of
the standard library, composed like ordinary Python functions:
from phyelds.calculus import aggregate
from phyelds.libraries.collect import collect_or
from phyelds.libraries.device import sense
from phyelds.libraries.distances import neighbors_distances
from phyelds.libraries.spreading import distance_to
WIDTH = 0.8
@aggregate
def corridor() -> bool:
distances = neighbors_distances()
to_target = distance_to(sense("target"), distances) # gradient towards the target
on_path = collect_or(to_target, sense("source")) # mark the path from the source
return distance_to(on_path, distances) < WIDTH # widen it into a corridor
Every device runs the same function, talking only to its neighbors, and the
corridor heals by itself when devices move or fail. The
tutorial builds it step by step from
remember and neighbors, and the
playground runs it
in your browser.
What's inside
- Core primitives:
@aggregate,remember,neighbors,exchange,align, and theNeighborhoodFieldabstraction 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: a pluggable discrete-event simulator with live rendering, animation
export, and VMAS
integration (
phyelds-vmas).
Everything is explained in the documentation: thinking in fields, core concepts, libraries, simulator, integration with other runtimes, and common pitfalls.
Heritage & Related Projects
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
exchangeprimitive (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
NeighborhoodFieldAPI and automatic alignment of standard language control flow (if/elseAST 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
- Gianluca Aguzzi (@cric96) — gianluca.aguzzi@unibo.it
- Davide Domini (@davidedomini) — davide.domini@unibo.it
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 7.6.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| phyelds-7.6.5.tar.gz | 50.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phyelds-7.6.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 112.0 kB
Release files / phyelds-7.6.5.tar.gz
| Download URL | phyelds-7.6.5.tar.gz |
|---|---|
| Size | 50.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce593f12fd9571cac0370bf8f2e7493fa54ef64121a208cc114361546cfd50ba
|
|
BLAKE2b-256 checksum How to use checksums |
ef48f9ba6037816d51260bfed4cd85530d845154eaa7b4c4453dcd38ca78f0d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.13.16 Linux/6.17.0-1022-azure
|
Release files / phyelds-7.6.5-py3-none-any.whl
| Download URL | phyelds-7.6.5-py3-none-any.whl |
|---|---|
| Size | 62.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7db5d053797f69f60b3d441fc6e0362b57ffedf1e5c5bd2bdcac87452baa334
|
|
BLAKE2b-256 checksum How to use checksums |
1e1938b9ba46357e66c1c117f582e0099d23e3ed55d95951e358766b6828b54f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.13.16 Linux/6.17.0-1022-azure
|
Security for phyelds 7.6.5
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.