Skip to main content

selective-deps

Declare file dependencies for test selection and incremental tooling in any language:

pip install selective-deps

This package installs Pydantic and PyYAML. It does not depend on pytest or pytest-selective, register plugins, inspect Python imports, open a graph cache, or run Git. The full pytest-selective package uses this same implementation.

Place a sidecar next to the code that reads an input, for example web/catalog.ts.gv-dependency.yaml:

dependencies:
  - inputs: ["//fixtures/catalog/*.json"]
    kind: content
    reason: The catalog loader reads these files at runtime.

Use .gv-dependencies.yaml for several readers in one directory, adding readers: ["*.ts"] to each rule. Paths are relative to the manifest directory; // anchors a path at the repository root. relative_to: reader resolves unanchored inputs relative to each reader instead. *, ? and whole-segment ** patterns use the same validation as Python declarations.

Prefer one directory manifest to a sidecar per file. In a manifest, {stem} in an input is each reader's file name before its first dot, so inputs: ["{stem}.mjs"] pairs report.test.mjs with report.mjs. A rule with inputs: [] records readers reviewed as having no repository inputs, such as scripts that read only generated reports; it requires a reason and takes no kind. Use reason rather than YAML comments to explain any rule.

The adapter supplies a complete tracked-file inventory and the declaration bytes from one snapshot:

from selective_deps import dependency_edges

files = {"web/catalog.ts", "web/catalog.ts.gv-dependency.yaml", "fixtures/catalog/demo.json"}
manifests = {
    "web/catalog.ts.gv-dependency.yaml": b"dependencies:\n  - inputs: ['//fixtures/catalog/*.json']\n    kind: content\n"
}
edges = dependency_edges(manifests, files, revision="checked-out-commit")

crowded_sidecars(files) returns each directory holding more than one file sidecar, so an adapter can ask authors to merge them into one directory manifest.

The result of dependency_edges maps readers to dependencies. kind: import creates ordinary path nodes whose transitive imports the language adapter should follow. kind: content creates @contents:<path> leaf nodes: reading a source file as text does not execute its imports. contents_node(path) and file_of(node) expose these semantics without requiring a caller to reproduce the encoding.

Combine these edges with the native language graph before traversing it. A changed file affects both its ordinary path node and its content node. Include base and head graphs when handling removals. Manifest files themselves are dependencies of their readers, so changing a declaration also selects those readers.

Malformed YAML, duplicate keys, aliases, missing owners, unmatched patterns and an incomplete declaration inventory raise DependencyDeclarationError. Report that error rather than treating a partial graph as proof to skip work. Declaration parsing does not discover undeclared runtime reads or prove test completion.

Metadata

Release files for selective-deps 1.9.1

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

Source distribution (sdist)

Source distribution for selective-deps 1.9.1
File Size Uploaded Provenance Actions
selective_deps-1.9.1.tar.gz 9.8 kB With provenance Details for selective_deps-1.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for selective-deps 1.9.1
File Interpreter ABI Platform Actions
selective_deps-1.9.1-py3-none-any.whl Python 3 none any Details for selective_deps-1.9.1-py3-none-any.whl

Total release size: 21.3 kB

Release files / selective_deps-1.9.1.tar.gz

Download URL selective_deps-1.9.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
66323f0c43bd8f1fe3e505d58eac49c69049b0bc2ed333b90e57127bc489ae2e
BLAKE2b-256 checksum
How to use checksums
9560ea89004851efe64f25b741b174bf12db4376b9f1ac86f110e82cc8ed4f85
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 20, 2026.

Transparency log

Release files / selective_deps-1.9.1-py3-none-any.whl

Download URL selective_deps-1.9.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80f96f2d41052ad8e28d8a83b9d079b1f889807ad168e03621af96548309ba79
BLAKE2b-256 checksum
How to use checksums
8f406da070605c440d998c0a8b0ec830ae1147d9dbb3601d7030cff148dfa487
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 20, 2026.

Transparency log

Security for selective-deps 1.9.1

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 selective_deps-1.9.1.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 20, 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.

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