Skip to content

[FEA]: enforce co-dependent values to stay in sync via blockwatch #3221

Open

Description

@mennanov

Is this a duplicate?

Area

Infrastructure

Is your feature request related to a problem? Please describe.

Several values in cuda-python are written in more than one file. One of them has a Python script that checks it, and the others only have a "keep in sync" comment:

Value Copies Checked today?
CUDA Toolkit version (major.minor) ci/versions.yml (cuda.build.version), cuda_bindings_13/pixi.toml, cuda_core/pixi.toml (2 keys each) Yes, by ci/tools/check_pixi_cuda_version.py (91 lines) and its pre-commit hook
Backport branch ci/versions.yml (backport_branch), .github/dependabot.yml (target-branch) No, only a comment on each side
gh-pages lock name concurrency.group in build-docs.yml, coverage.yml and cleanup-pr-previews.yml; GH_PAGES_PUBLISH_LOCK in cleanup-pr-previews.yml; ci/cleanup-pr-previews No, only a "Must match every job that writes to gh-pages" comment

Describe the solution you'd like

Add blockwatch, a linter I am working on, as one pre-commit hook.

The rules are defined in the source code comments or in blockwatch.toml.
For example:

# ci/versions.yml is the source of truth. The pixi environments
# must pin the same major.minor versions (13.4.2 in CI, "13.4.*" in pixi).
[[block]]
target = '{cuda_bindings_13,cuda_core}/pixi.toml#/feature/cu13/dependencies/cuda-version'
same-as = 'ci/versions.yml#/cuda/build/version'
same-as-pattern = '^(?P<value>\d+\.\d+)\.'

The change:

  • replaces ci/tools/check_pixi_cuda_version.py and its check-pixi-cuda-version hook with two rules
  • adds checks for the backport branch and the gh-pages lock name
  • updates the "keep in sync" comments to say that blockwatch.toml checks them

A failure looks like this, after bumping cuda.build.version to 13.5.0 without touching the pixi files:

Block cuda_core/pixi.toml:(unnamed) at line 11 of "blockwatch.toml" disagrees with
ci/versions.yml#/cuda/build/version: ["13.4"] != ["13.5"]

The hook installs a prebuilt binary from PyPI (blockwatch-cli, wheels for Linux, macOS and Windows).
A full run takes about 0.05 s.

A working example is in my fork: mennanov#1

Describe alternatives you've considered

Extending check_pixi_cuda_version.py, or adding a script per value. Each new value would then need its own parsing and its own hook.

Additional context

I'd be happy to open the PR here if this looks useful to you. The tool is capable of doing a lot more than the example PR does (it is minimal on purpose), feel free to ask any questions.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions