Skip to main content

PyreWire

CI Docs

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.0 wheel targets and source-install requirements, including supported OS/architecture combinations and libwirelog handling. The API stability policy defines the v1.0 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 Session API
  • 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!

License

PyreWire (Python Wrapper): dual-licensed under either of

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.0.5

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

Source distribution (sdist)

Source distribution for pyrewire 1.0.5
File Size Uploaded
pyrewire-1.0.5.tar.gz 138.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyrewire 1.0.5
File
pyrewire-1.0.5-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pyrewire-1.0.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyrewire-1.0.5-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
pyrewire-1.0.5-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pyrewire-1.0.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyrewire-1.0.5-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pyrewire-1.0.5-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pyrewire-1.0.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyrewire-1.0.5-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pyrewire-1.0.5-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pyrewire-1.0.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
pyrewire-1.0.5-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 3.3 MB

Release files / pyrewire-1.0.5.tar.gz

Download URL pyrewire-1.0.5.tar.gz
Size 138.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e29d1e15ba8d77801716425ebe9b5b80baa3b30800840e50847b4a0012850884
BLAKE2b-256 checksum
How to use checksums
be4410159bfb2377e9d00f8cad7f58710a4c921451dfec7f238943b1865b9bbf
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp314-cp314-win_amd64.whl

Download URL pyrewire-1.0.5-cp314-cp314-win_amd64.whl
Size 286.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
a302ed07a0ceff8d41e7fd4a2aa2f8e37b5b1ce2b98a9d8c3d41404d297a93e2
BLAKE2b-256 checksum
How to use checksums
6d7f8038a7496643f25ff54742d3a6cb196d8f70c4734a4c462ae1b2c12a0427
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyrewire-1.0.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 262.3 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
501815aaa569408caf5e6ab44f506b9c8ae0e8d8eb30e39bca4e95eaf849584c
BLAKE2b-256 checksum
How to use checksums
696fb2d31303127573dbbce489ad6614895a7810c85ee1cb2e212c06f8478fef
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp314-cp314-macosx_11_0_arm64.whl

Download URL pyrewire-1.0.5-cp314-cp314-macosx_11_0_arm64.whl
Size 247.9 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fe7e3c6913a9b517686b99189292f3a9584d88b7c3ab70d202c67b6986f7c32d
BLAKE2b-256 checksum
How to use checksums
c6141772ecd0d93404d329443398ceccacd6ce21558f68ed15d927e5e9e87ab0
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp313-cp313-win_amd64.whl

Download URL pyrewire-1.0.5-cp313-cp313-win_amd64.whl
Size 280.6 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6bac633be820233c43ccc782eacbbabef9806407d7f1e22af80ae13258391d48
BLAKE2b-256 checksum
How to use checksums
18573a8f077d1a102814bf3a1741db7206328126b0eda060cb48e296f963a586
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyrewire-1.0.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 262.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
cbf0737a517ef7a69d3da1409e0465f1edb29c9e4b6e58a0e8ec738427a338ff
BLAKE2b-256 checksum
How to use checksums
f8c83aba51e1600e46c2f6f814b9463b8f22441e71c28822df0128bec7c4e212
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp313-cp313-macosx_11_0_arm64.whl

Download URL pyrewire-1.0.5-cp313-cp313-macosx_11_0_arm64.whl
Size 247.9 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6e9ec1b130970c112cfb0d0dd941f96690828a91ed15efd1e068f6ea4d085f52
BLAKE2b-256 checksum
How to use checksums
48d139987f77e3ae6e6f1cc4ba9d656147ce74be35dd90bf87136f3928ef1116
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp312-cp312-win_amd64.whl

Download URL pyrewire-1.0.5-cp312-cp312-win_amd64.whl
Size 280.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
32d106999463520e6b1d2f7a9b85f4a2af15c1b60225ac31ab9f86e009907d83
BLAKE2b-256 checksum
How to use checksums
ebf50e3a2b05d2ce7c6ecdd4a8f815f9202afd762474ab1bd67c2710a2ec73ea
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyrewire-1.0.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 262.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5965208dc57af7c1e125cbe146845f69e84d16197c154681e53ac47b23a7517b
BLAKE2b-256 checksum
How to use checksums
f556ff48cd518ea43fbc681d62fd4ce38c5d9f53514c58971cfd3dd470210529
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp312-cp312-macosx_11_0_arm64.whl

Download URL pyrewire-1.0.5-cp312-cp312-macosx_11_0_arm64.whl
Size 247.9 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
05f8d733a6674f59b0474b6a25be7ee609ccf1c67afd6d214fbba134d7ae8ad8
BLAKE2b-256 checksum
How to use checksums
57c6253a80f066381ac4595b55d809f4ba13439ab0f71514dc9ec33fa5502466
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp311-cp311-win_amd64.whl

Download URL pyrewire-1.0.5-cp311-cp311-win_amd64.whl
Size 280.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8c5032536453822a09bb534f8f2bbb74c8b7ccc97641c6ae6606e1c858b01614
BLAKE2b-256 checksum
How to use checksums
2cf0e0556f0e84db529d0b2cc17d76e98f58808f43e625999e28dd4e899421f1
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyrewire-1.0.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 262.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3c867bc5a3fd9027eed39c805c6b3889c28dda359e3b1cd9b7908427a19ce2e8
BLAKE2b-256 checksum
How to use checksums
0a748d4d2974f5e72167ba5f38ade876c2974391e9288013298da3b0e0dbd0fe
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 Aug 11, 2026.

Transparency log

Release files / pyrewire-1.0.5-cp311-cp311-macosx_11_0_arm64.whl

Download URL pyrewire-1.0.5-cp311-cp311-macosx_11_0_arm64.whl
Size 247.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
794b139afeb8b4cd2e1637fc81fccbf377971de54b25dd9f34f1e05a4e2d3201
BLAKE2b-256 checksum
How to use checksums
f69abd39397d0a98335346a5096b2e7319dec7fdb4ee6bb913da9f9f656c4c9d
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 Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.2

13 release files

1.1.1

13 release files

1.1.0

13 release files

This release

1.0.5 This release

13 release files

1.0.4

13 release files

1.0.3

13 release files

1.0.2

13 release files

1.0.1

13 release files

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