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")

The result 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.8.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.8.0
File Size Uploaded Provenance Actions
selective_deps-1.8.0.tar.gz 9.6 kB With provenance Details for selective_deps-1.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 20.6 kB

Release files / selective_deps-1.8.0.tar.gz

Download URL selective_deps-1.8.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
74973f8a8e1cd71d62d8a1acd4a5b81912e9879086c0f223ca686fd20dbc7ac4
BLAKE2b-256 checksum
How to use checksums
b1b867b3661856806b8f105903a21c82847cb3ea73543680ffbebadfb9d2210f
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 18, 2026.

Transparency log

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

Download URL selective_deps-1.8.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
122c4cbb51c04004a26f657c3253c70c2981c77fb6fd46b944db5c4d801c2307
BLAKE2b-256 checksum
How to use checksums
cfbb3d44424b2bcd883adcaddd032290aefacdc02101f90047aa738686a13430
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 18, 2026.

Transparency log

Security for selective-deps 1.8.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.8.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 18, 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