Yarrow Diagrams
⚠️ yarrow is still early in development ⚠️: it's missing some features, and not everything is documented. Consider yourself warned!
yarrow is a Python library implementing the datastructures and algorithms for string diagrams described in the paper Data-Parallel Algorithms for String Diagrams.
What is yarrow?
For a programmer's overview of what yarrow is for, see the documentation. In short, the main datastructure of yarrow is the Diagram, which can be thought of a generalisation of syntax trees to syntax graphs.
Here's an example of a string diagram depicted graphically:
You could think of this as representing the syntax of the following python program:
def compute_mean(numbers: List[int]):
count, sum = summary(numbers)
return divide(sum, count)
String diagrams are different from directed graphs in two important ways:
- The boxes (operations) in a string diagram have multiple ordered inputs and outputs in the same way a python function has ordered input arguments.
- The diagram itself has inputs and outputs depicted as "dangling" wires on the left and right
Other examples of structures which can be represented by string diagrams are electronic circuits, quantum circuits, neural networks, and many more. For a more formal introduction to string diagrams aimed at computer scientists, try this recent paper.
Installation
pip install yarrow-diagrams
Running tests
Install test dependencies
pip install hypothesis
Run test with your test runner, e.g.
pytest
Yarrow as a Reference Implementation
Yarrow is intended as a reference implementation for the paper. It has the following goals:
- Fast, data-parallel, and runs on the GPU
- Minimal primitives/dependencies required
- Simple to implement correctly
The aim is to serve as a general-purpose datastructure in many languages by making it simple to implement fast algorithms while relying on few external dependencies.
To port yarrow to your language, the only things needed are:
- Arrays and simple array subroutines (see the numpy backend or Section 2.2.2 of the paper.)
- An algorithm for computing connected components.
Porting Yarrow
If you want to port Yarrow to a different language and you would like help, please reach out. Here are some places you could do that:
- discord
##yarrowonirc.libera.chat- email the author
Metadata
Release files for yarrow-diagrams 0.0.3.1
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 | Actions |
|---|---|---|---|---|
| yarrow_diagrams-0.0.3.1.tar.gz | 23.4 kB | Without provenance | Details for yarrow_diagrams-0.0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yarrow_diagrams-0.0.3.1-py3-none-any.whl | Python 3 | none | any | Details for yarrow_diagrams-0.0.3.1-py3-none-any.whl |
Total release size: 55.2 kB
Release files / yarrow_diagrams-0.0.3.1.tar.gz
| Download URL | yarrow_diagrams-0.0.3.1.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9726e59279ce6c43bdc71db5450dbedb6afc5674b7f1e1c64fbe4aa85dc592cf
|
|
BLAKE2b-256 checksum How to use checksums |
77629527d85d3b41ee49c81802b54ac7d761fa860f1636114a9e8dd73eae54f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / yarrow_diagrams-0.0.3.1-py3-none-any.whl
| Download URL | yarrow_diagrams-0.0.3.1-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76aec346da8d5bd911d98348954b8925402b1ccdbba003943672db1538e9d391
|
|
BLAKE2b-256 checksum How to use checksums |
1c7b62777d9f3f4d5acff1e1632f8106515d9aa2aedc83f0edaccb5d5423874a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for yarrow-diagrams 0.0.3.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.