pyinc
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, and has zero runtime dependencies. Python 3.11–3.14 are tested on Linux, macOS, and Windows.
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.
For files, environment variables, and directories, use a Resource rather
than reading ambient state directly inside a query. The
getting-started guide
walks through inputs, resources, modes, inspection, and a first declared-output
action.
Correctness contract
pyinc guarantees from-scratch consistency: incremental evaluation matches
a fresh evaluation on the same declared inputs and resources. That guarantee
holds only when all three conditions hold:
- Owned value boundaries. Query arguments, query results, and
Inputvalues are snapshot-safe or handled by a registeredValueAdapter. - Tracked ambient reads. External state read by a query goes through a
Resource; reads the guard cannot intercept are declared withdb.report_untracked_read(reason). - Deterministic queries. The same tracked dependencies produce a semantically equal result.
The kernel contract defines the exact value rules, intercepted operations, execution modes, durable checkpoint trust boundary, and documented limitations.
Packages
One distribution ships three top-level typed packages; the stable integration
surface is a subpackage of pyinc:
| Package | Purpose | Start here |
|---|---|---|
pyinc |
Stable query kernel, resources, snapshots, artifact stores, and declared-output actions. | Kernel contract |
pyinc.integrations |
Stable, frozen analysis results and high-level entrypoints for Python source, configuration, dependencies, symbols, and notebooks. | Integration contract |
pyinc_tools |
pyinc-tools analyze, a polling watcher, WorkspaceSession, and a stdio LSP server built on the integration API. |
Tooling guide |
pyinc_codegen |
JSON Schema to typed Python generation through the public query and action APIs. | Codegen guide |
Queries remain pure. Filesystem writes belong to the separate @action layer,
which reconciles a complete desired output set with atomic file replacement,
tamper repair, orphan cleanup, and dry-run planning. See the
action contract.
Documentation
- Getting started — build a small graph, add a tracked file, choose a mode, inspect work, and write a first action.
- Architecture — package boundaries and how the kernel, integrations, tools, and codegen fit together.
- Kernel contract — the normative soundness envelope.
- Action contract — declared-output reconciliation.
- Integration contract — stable entrypoints, result types, supported shapes, and limits.
pyinc-toolsguide and LSP reference — CLI, editor setup, overlays, protocol methods, and user-visible limitations.- Integration authoring — the three-layer integration pattern.
- Migrating from 2.x — state cleanup and 3.0 API changes.
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
Run python -m pyinc_tools --help for the installed command-line tools. The
module form and the pyinc-tools console script are equivalent.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyinc-3.0.0.tar.gz.
File metadata
- Download URL: pyinc-3.0.0.tar.gz
- Upload date:
- Size: 559.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9f3628735fedbd8bfd20d94cf9913b23393598ed3bc684b5e3ca22c7b0db2a9
|
|
| MD5 |
ec9667e648e2db8d6964e394a5d93a77
|
|
| BLAKE2b-256 |
fbf9fc7e8f82f0e0deb0197d48f188963f710c015a7857414e12672fdf8d667a
|
Provenance
The following attestation bundles were made for pyinc-3.0.0.tar.gz:
Publisher:
release.yml on Brumbelow/pyinc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyinc-3.0.0.tar.gz -
Subject digest:
f9f3628735fedbd8bfd20d94cf9913b23393598ed3bc684b5e3ca22c7b0db2a9 - Sigstore transparency entry: 2158061096
- Sigstore integration time:
-
Permalink:
Brumbelow/pyinc@deca94581a912827f723cc16311ea5a3d6796841 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/Brumbelow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@deca94581a912827f723cc16311ea5a3d6796841 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyinc-3.0.0-py3-none-any.whl.
File metadata
- Download URL: pyinc-3.0.0-py3-none-any.whl
- Upload date:
- Size: 243.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35dbe111f375eee71b12470440ff52bc583e68a7611453bf9b08612360404c54
|
|
| MD5 |
cc3dbacf3cd98eed2e66b2c4a99888ec
|
|
| BLAKE2b-256 |
d485ec06755e7b9d6956ec4b8f35a9648570d39e2caafb2b7ddfb5b49e552326
|
Provenance
The following attestation bundles were made for pyinc-3.0.0-py3-none-any.whl:
Publisher:
release.yml on Brumbelow/pyinc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyinc-3.0.0-py3-none-any.whl -
Subject digest:
35dbe111f375eee71b12470440ff52bc583e68a7611453bf9b08612360404c54 - Sigstore transparency entry: 2158061126
- Sigstore integration time:
-
Permalink:
Brumbelow/pyinc@deca94581a912827f723cc16311ea5a3d6796841 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/Brumbelow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@deca94581a912827f723cc16311ea5a3d6796841 -
Trigger Event:
push
-
Statement type: