Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea: linting dependencies.yaml files via '--strict' #103

Open
jameslamb opened this issue Jul 24, 2024 · 1 comment
Open

idea: linting dependencies.yaml files via '--strict' #103

jameslamb opened this issue Jul 24, 2024 · 1 comment
Labels
feature request New feature or request

Comments

@jameslamb
Copy link
Member

jameslamb commented Jul 24, 2024

Description

I just manually updated a LOT of dependencies.yaml files across RAPIDS (rapidsai/build-planning#31), and found myself looking for some things manually that should be possible to enforce with a linter.

This issue proposes adding a --strict argument to rapids-dependency-file-generator, which enforces more standardization across dependencies.yaml files.

Benefits of this work

  • greater standardization of dependencies.yaml files should reduce the effort to do all-of-RAPIDS migrations (either manually or with rapids-reviser)
  • may help to reduce complexity of the files
  • could save some reviewer effort (e.g. the need to leave comments that are about personal preference and style)

Acceptance Criteria

  • rapids-dependency-file-generator enforces some linting checks on dependencies.yaml files
  • that enforcement is opt-in (off by default)
  • that enforcement is deployed across all RAPIDS repos .pre-commit-config.yaml configurations using rapids-dependency-file-generator as a hook

Approach

I'm proposing that if a flag --strict is passed to rapids-dependency-file-generator, it check the content of the YAML file passed to --config and raise a non-0 exit code if any of a set of opt-in linting rules are violated.

I'll list some initial ideas I have here. I'm sure others will have more. For most of these, I have lightly-held opinions about which should be the preferred pattern, and care more that there be some preferred pattern and a tool to automatically enforce that preference.

  • preferring indented lists to inline [] lists
# this
packages:
  - rmm-cu12

# not this
packages: [rmm-cu12]
  • preferring indented maps to inline {} maps
# this
matrix:
  cuda: "12.*"

# not this:
matrix: {"cuda": "12.*"}
  • preferring explicit : null to implicit (which might catch some mistakes)
# this
- matrix: null
  packages: null

# not this
- matrix:
  packages:
  • disallowing any anchors that are never re-used
# failing if this is never met by a corresponding '*cupy_cu12'
- matrix:
    cuda: "12.*"
   packages:
     - &cupy_cu12 cupy-cuda12x>=12.0.0

Notes

This proposal is inspired by mypy --strict (mypy docs).

And by conversations like this: rapidsai/rmm#1627 (comment)

@jameslamb jameslamb added the feature request New feature or request label Jul 24, 2024
@jameslamb
Copy link
Member Author

Thinking more about this this morning.... all of the examples I gave are generic YAML-formatting things and not specific to rapids-dependency-file-generator. Maybe just yamllint or similar could be used to enforce those things if we wanted, with no changes to rapids-dependency-file-generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant