Skip to main content

pyinc

CI PyPI version Python versions PyPI license Lint: Ruff

Salsa-style red-green queries, hardened for Python's mutable runtime.

pyinc is a correctness-first incremental query engine for Python. Declare keyed inputs and pure queries, and it records the dependency graph while your code runs. On the next request it reuses unaffected work, recomputes affected queries, and backdates semantically equal results so downstream work stays valid. It is pure Python, stdlib-only, with zero runtime dependencies; Python 3.11–3.14 are tested on Linux, macOS, and Windows. It exists so that the cache-invalidation bugs of a hand-rolled caching layer — the editor still underlining an error you fixed a minute ago — have somewhere to be caught.

python -m pip install pyinc

Quick start

from pyinc import Database, Input, query

NAMES = Input[tuple[str, ...]]("example.names")


@query
def normalized_names(db: Database) -> tuple[str, ...]:
    return tuple(sorted({name.strip() for name in NAMES.read(db)}))


db = Database(mode="strict")
db.set(NAMES, (" Grace ", "Ada", "Ada"))
assert db.get(normalized_names) == ("Ada", "Grace")

db.set(NAMES, ("Grace", "Ada"))
assert db.get(normalized_names) == ("Ada", "Grace")
assert db.inspect(normalized_names).last_decision == "backdated"

The first request computes the result. The second input is different, so the query runs again, but its result is semantically equal. pyinc backdates that node instead of invalidating anything downstream.

See it on a real workspace

Editing pytest under pyinc's watcher

pyinc-tools was pointed at a pinned checkout of pytest — nothing in it adapted for pyinc — and watched while single files were edited: in one recorded run, 109.08 s to analyze all 270 files from cold, then 632 ms to catch up after an edit. Timings are machine-specific; the demo page has the clips, the full provenance, and the deterministic work counts.

Documentation

  • Getting started — build a small graph, add a tracked file, choose a mode, inspect work, and write a first action.
  • Examples — small runnable scripts, including the calc worked example.
  • FAQ — how this relates to Salsa, why not lru_cache, threading, scope, and when not to use it.
  • Kernel contract — the from-scratch consistency guarantee, its three conditions, modes, checkpoints, and limitations; the action contract covers declared-output reconciliation.
  • Integration contract — stable entrypoints, result types, supported shapes, and limits.
  • pyinc-tools guide and LSP reference — CLI, editor setup, overlays, protocol methods, and user-visible limitations.
  • Documentation index — every document, the package map, and the authoring and codegen guides.
  • Releases and verification — signed tags, trusted publishing, and checking a download.

One distribution ships three top-level typed packages:

  • pyinc — the stable query kernel, resources, snapshots, artifact stores, and declared-output actions
  • pyinc.integrations — stable analysis results and entrypoints for Python source, configuration, dependencies, symbols, and notebooks
  • pyinc_tools — unstable: pyinc-tools analyze, a polling watcher, WorkspaceSession, and a stdio LSP server
  • pyinc_codegen — unstable: JSON Schema to typed Python generation

Development

git clone https://github.com/Brumbelow/pyinc.git
cd pyinc
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -e '.[dev]'
python3 scripts/check_docs.py
pytest -q
python3 -m mypy src tests bench scripts
python3 -m ruff check src tests bench scripts

Metadata

Release files for pyinc 4.0.0

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

Source distribution (sdist)

Source distribution for pyinc 4.0.0
File Size Uploaded
pyinc-4.0.0.tar.gz 2.6 MB Details

Built distribution (wheel)

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

Total release size: 3.0 MB

Release files / pyinc-4.0.0.tar.gz

Download URL pyinc-4.0.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
985ebed67fa9532ebe1ab7398028c8f3a4249039f76a99b3668f24f800d6e004
BLAKE2b-256 checksum
How to use checksums
bb2f4c4ae7f89c9af29bf228941f262dc1f15039a124949cb5c313dad0eb0649
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 4, 2026.

Transparency log

Release files / pyinc-4.0.0-py3-none-any.whl

Download URL pyinc-4.0.0-py3-none-any.whl
Size 342.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15dc8bb215f7e13f0fd31c11d1771b3f6d371dae0ccf8334df844c653ab260f9
BLAKE2b-256 checksum
How to use checksums
62aa853030271966bdf63438e6012e0af6365789ffec1d8b064a52352983d44e
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 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 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