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.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.9.0
File Size Uploaded Provenance Actions
selective_deps-1.9.0.tar.gz 9.8 kB With provenance Details for selective_deps-1.9.0.tar.gz

Built distribution (wheel)

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

Total release size: 21.3 kB

Release files / selective_deps-1.9.0.tar.gz

Download URL selective_deps-1.9.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
71b63b66658d88bddf04f6dc6c2e8003967a8aa94f9f62aa3b96912a2fdb5e25
BLAKE2b-256 checksum
How to use checksums
54f04129fd387b2d06cc1def39d89029a9b2036e77522428704d2e001c871479
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.9.0-py3-none-any.whl

Download URL selective_deps-1.9.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db7691f8d5d7c2cb9b5d036d93ebd64ff43208dd24d02d4ab0062baa1ce5a8bd
BLAKE2b-256 checksum
How to use checksums
8b7cfcff839adee509e7f41b2a1f44d23e860b292a54e35cb7fbe9e937bad5f1
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.9.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.9.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