PyreWire
The ci workflow runs the full lint gate (black, isort, flake8, mypy)
and the test matrix; docs builds and publishes the documentation site.
A Python wrapper for wirelog - a declarative dataflow analysis engine.
Overview
PyreWire provides a Pythonic interface to wirelog, enabling you to write datalog programs and perform analysis programmatically from Python.
Installation
pip install pyrewire
Requirements: CPython 3.11, 3.12, 3.13, or 3.14.
See the support matrix for v1 wheel targets and
source-install requirements, including supported OS/architecture
combinations and libwirelog handling. The
API stability policy defines the v1 stable
public import boundary and deprecation policy.
Quick Start
PyreWire programs are written in wirelog's datalog dialect and driven through one of the high-level surfaces below.
One-shot evaluation with BatchProgram
Use BatchProgram to parse a program, optimize it, and compute the full
IDB closure in a single pass:
from pyrewire import BatchProgram
# A tiny reachability program: two edges plus a transitive-closure rule.
src = """
.decl edge(x: int32, y: int32)
.decl reach(x: int32, y: int32)
edge(1, 2). edge(2, 3).
reach(X, Y) :- edge(X, Y).
reach(X, Z) :- reach(X, Y), edge(Y, Z).
"""
with BatchProgram.from_string(src) as program:
program.optimize()
result = program.evaluate()
try:
print(result.cardinality("reach")) # 3
print(result.relation("reach")) # [(1, 2), (2, 3), (1, 3)]
finally:
result.close()
Incremental work with EasySession
EasySession interns strings automatically and lets you insert /
remove facts, then either snapshot a relation's full contents or
step the engine for incremental deltas. A session commits to a single
mode the first time you query it, so use a fresh session per mode:
from pyrewire import EasySession
SRC = """
.decl friend(a: symbol, b: symbol)
.decl mutual(a: symbol, b: symbol)
mutual(A, B) :- friend(A, B), friend(B, A).
"""
# snapshot(): read a relation's full IDB contents.
with EasySession(SRC) as s:
s.insert("friend", ["alice", "bob"])
s.insert("friend", ["bob", "alice"])
print(s.snapshot("mutual")) # [('alice', 'bob'), ('bob', 'alice')]
# step(): drive one fixpoint step and read the incremental deltas.
with EasySession(SRC) as s:
s.insert("friend", ["alice", "bob"])
s.insert("friend", ["bob", "alice"])
for relation, row, diff in s.step():
print(relation, row, diff) # e.g. mutual ('alice', 'bob') 1
For caller-owned programs, backend selection, and NumPy zero-copy
inserts, see Session; for asyncio integration see AsyncEasySession,
AsyncSession, and AsyncBatchProgram. The
Quickstart walks through each surface.
Features
- Pythonic API over wirelog's declarative dataflow engine
- Batch closure (
BatchProgram) and incremental sessions (EasySession,Session) - NumPy zero-copy batched inserts on the advanced
SessionAPI - asyncio wrappers that satisfy wirelog's single-threaded call invariant
Development
Setup
git clone https://github.com/semantic-reasoning/PyreWire
cd PyreWire
pip install -e ".[dev]"
Running Tests
pytest
Code Quality
black .
isort .
flake8 .
mypy .
Community & Contributing
We appreciate your interest in contributing to PyreWire!
- Contributing Guide: Learn how to set up development, run tests, and submit pull requests
- Code of Conduct: Read our community standards and expected behavior
- Security Policy: Report security vulnerabilities responsibly
License
PyreWire (Python Wrapper): dual-licensed under either of
- Apache License, Version 2.0
- GNU General Public License, version 3 or (at your option) any later version
at your option.
wirelog (Core Engine): LGPL-3.0 / Commercial Dual License
Note: PyreWire links to the wirelog core engine. Use of the core engine is subject to its respective license terms.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Metadata
Release files for pyrewire 1.1.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 | |
|---|---|---|---|
| pyrewire-1.1.1.tar.gz | 159.8 kB | Details |
Built distributions (wheels)
Total release size: 4.2 MB
Release files / pyrewire-1.1.1.tar.gz
| Download URL | pyrewire-1.1.1.tar.gz |
|---|---|
| Size | 159.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef4433819e837494bc0ff1c7e5e8c3e6b08b940e5534f347eab3c1d4aa3939d7
|
|
BLAKE2b-256 checksum How to use checksums |
2af0a4be2f401a3a448f7445aa866c0803267983f9a0a9c07d9ea8c8460d81f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp314-cp314-win_amd64.whl
| Download URL | pyrewire-1.1.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 371.6 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fbd6f90f5a305151231b5cd8364956551c00d443dd08d35d7708121069da7bce
|
|
BLAKE2b-256 checksum How to use checksums |
08176b68b048d16bb2b0b2fb3184b3140d74002647f61f58669fe8d8dcec3b7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyrewire-1.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.4 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
48aee8ace31eb90c43f24867c5d729882986833133dc1985be635ed5c3b1dd7d
|
|
BLAKE2b-256 checksum How to use checksums |
b0bb77a5950e4d6a9fc28f2afe8be7cf23a6b4c421bcd9bd4818f6465fda8b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | pyrewire-1.1.1-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 315.4 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3cedffe6bfa5e2f396b65ada2bc2d17d5f85771bfcb33e3763220a0e2a019ac0
|
|
BLAKE2b-256 checksum How to use checksums |
82a4d2454d7ea9cdf2ea814ca2b0eab39c7bc5b41a1bef4ec1bb0f3919990f10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp313-cp313-win_amd64.whl
| Download URL | pyrewire-1.1.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 364.5 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1d7500e8073ef217ac3fd947d62a2d86b24fca8420c6270a8051d9c727a1b751
|
|
BLAKE2b-256 checksum How to use checksums |
d4bdd15738ed39925d4efd4f5a3c320eaa3595abedb3a03ef57464326bee3290
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyrewire-1.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.4 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0c5ce50c5a1b260336d5ddbda6eecc318ac344db79a059201f631f78d0a68a09
|
|
BLAKE2b-256 checksum How to use checksums |
2c33b7fd5ab05ad9d0c24d1043126b6973ae7f64b27dcc8cb75c734688f09d74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pyrewire-1.1.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 315.4 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
24837b27f94dbd9ba194d549cea9eb40cf5b427650d9603f5ee7c438b85a54db
|
|
BLAKE2b-256 checksum How to use checksums |
57f04bc430a25017765aef2ba22547418b1356a8ba359b5a5605d602bd69bfce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp312-cp312-win_amd64.whl
| Download URL | pyrewire-1.1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 364.5 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
96fbef98e929e22f2051fdc5a47f1ec61a4fa525e0cd0baf3041326da4e576e2
|
|
BLAKE2b-256 checksum How to use checksums |
a772ab04169426d802b3601c8f51a20786b237d16dde4798917a6b0e545f5b85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyrewire-1.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
03100bf72e329e7a86ffda279449cd39e8061fa0cac64f07f7e013d7ef7b7aad
|
|
BLAKE2b-256 checksum How to use checksums |
9f7b1730bed198ed8e5efeedc3cb78d4c050fe7ff131c9dcb5169db3ab1b25d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pyrewire-1.1.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 315.4 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
df76df7a61cce06b38ba4b5185bc1212725c1a01e13ef8bd2306d09700705ff4
|
|
BLAKE2b-256 checksum How to use checksums |
7a9c9cc5643b1600f0edad8dde8d29b5fea31931b3873f64e228bb58d770f8d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp311-cp311-win_amd64.whl
| Download URL | pyrewire-1.1.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 364.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ca04e3ac0297c99a4c64727c39a363796bdb3d1d3328ec1e57417bd054effea8
|
|
BLAKE2b-256 checksum How to use checksums |
53e69fd12d6edd9de7ba65a6aba1ef9672f6cb89c1a5dd9b9062101f5f6b08a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyrewire-1.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 333.4 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9f09585db70e17f42b3baeb6cb41f7f216af726299a63c6977dd3ee9951c79b
|
|
BLAKE2b-256 checksum How to use checksums |
6a3bf919822d5f9753688b14bc2affcc8b3841e045116dd432de1da4c3fc3f9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency logRelease files / pyrewire-1.1.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pyrewire-1.1.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 315.4 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e69e96e2829f1ca0ed51f49d74b2d56dcc10293c146449080017d28fb9ad2e15
|
|
BLAKE2b-256 checksum How to use checksums |
481cde957d37912ac8ba2da2f0c2f94623b12d5e8413f3b3848940b3e11afbb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Sep 12, 2026.
Transparency log