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 and stdlib-only, with zero runtime dependencies. It is built to replace a hand-rolled caching layer and its cache-invalidation bugs, such as the editor still underlining an error you fixed a minute ago.

Python 3.11 to 3.14 and the free-threaded 3.14t build are supported and tested on Linux, macOS, and Windows. Python 3.15 and later are not supported, because query identity reads bytecode and module metadata, and both change with every CPython minor release.

python -m pip install pyinc

Status

pyinc is feature-complete. No new features are planned. Bug fixes and soundness fixes are welcome as pull requests. CONTRIBUTING.md has the setup and the checks. No response time is promised. The supported Python versions are 3.11 to 3.14, plus the free-threaded 3.14t build.

Semantic versioning covers only what pyinc and pyinc.integrations export. pyinc_tools and pyinc_codegen are feature-frozen: their behavior changes only to fix a defect.

Quick start

from __future__ import annotations

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, so everything downstream stays valid.

See it on a real workspace

Editing pytest under pyinc's watcher

pyinc-tools was pointed at a pinned checkout of pytest, with nothing in it adapted for pyinc, and watched while single files were edited. The recording was made with a development build of pyinc 3.1. The demo page has the clips and their provenance. For numbers from your own machine, run python -m bench.overhead from the repository root. It prints cost ratios measured in one run. The benchmark README describes the harness.

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: what the release workflow checks, trusted publishing, and checking a download.

One distribution ships three top-level typed packages: pyinc, pyinc_tools, and pyinc_codegen. The stable integration surface, pyinc.integrations, is a subpackage of pyinc.

  • 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 (feature-frozen): pyinc-tools analyze, a polling watcher, WorkspaceSession, and a stdio LSP server
  • pyinc_codegen (feature-frozen): 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]' -c constraints.txt
python3 scripts/check_docs.py
pytest -n auto -m 'not process' --ignore tests/test_properties.py --tb=short
python3 -m mypy src tests bench scripts examples
python3 -m mypy --platform win32 src tests bench scripts examples
python3 -m ruff check src tests bench scripts examples

Metadata

Release files for pyinc 6.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 6.0.0
File Size Uploaded Provenance Actions
pyinc-6.0.0.tar.gz 2.8 MB With provenance Details for pyinc-6.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.2 MB

Release files / pyinc-6.0.0.tar.gz

Download URL pyinc-6.0.0.tar.gz
Size 2.8 MB
Tags Source
SHA-256 checksum
How to use checksums
a54413efa0ede03c9248f0d3382d5e5cfe54cbb6974f58a8bebf6b1cc470e65a
BLAKE2b-256 checksum
How to use checksums
76bf10276b2833121bf01d87461bd9fa3f55e72e7525ac81edd2c30f03b2d4db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

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

Download URL pyinc-6.0.0-py3-none-any.whl
Size 386.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
151e91e20c4d70ef5ca2cb17a023a9078e0d7e418658e92f8044989617702956
BLAKE2b-256 checksum
How to use checksums
3f3fd88b262bb4dc3bdc2da232026121b8b5b02b78f4b50d010c4c75cef2737f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Security for pyinc 6.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyinc-6.0.0.tar.gz

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 Nov 14, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files Full provenance

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