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.10.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 selective-deps 1.10.0
File Size Uploaded Provenance Actions
selective_deps-1.10.0.tar.gz 9.8 kB With provenance Details for selective_deps-1.10.0.tar.gz

Built distribution (wheel)

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

Total release size: 21.3 kB

Release files / selective_deps-1.10.0.tar.gz

Download URL selective_deps-1.10.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8030f4afe82e8ac343bcb5273ed751414adf78ac8d2d3fbd447f9037f2fdcce2
BLAKE2b-256 checksum
How to use checksums
5c16e1019ca0df9dc98ca9e7555823277297775e5712368efd25e05975d7fa84
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 26, 2026.

Transparency log

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

Download URL selective_deps-1.10.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17f0a35f8ea353b7a296cbf4d60a63d1a0aee34740f5c16f6d757a9d9d37c8d6
BLAKE2b-256 checksum
How to use checksums
ee01cd940314e95fa103fddaf613f855c0c59528b08550358f9bc048f44edb8c
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 26, 2026.

Transparency log

Security for selective-deps 1.10.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 selective_deps-1.10.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 26, 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