sigstore / model-transparency

Supply chain security for ML
Apache License 2.0
105 stars 28 forks source link

Replace pylint with ruff #273

Closed spencerschrock closed 1 month ago

spencerschrock commented 1 month ago

Summary

Configure ruff with a barebones pyproject.toml to address the conversion mentioned in #232. I spent the time to do the switch now so I would stop messing up import ordering.

In terms of the rules selected, https://github.com/sigstore/model-transparency/commit/7f85551a332806989291ab144a0c2264c2a72f82 talks about the motivation for picking them, but I'm happy to adjust as needed, or include the reasons in the config file itself.

select = [
    "B", # flake8-bugbear
    "E", # pycodestyle
    ...
]

I wasn't sure where to place the pyproject.toml but we have options (including making it a .ruff.toml for now):

  1. The repository root, which would allow us to configure ruff in one spot for both model_signing and slsa_for_models. The tool.ruff section can extend other pyproject.tomls, so if we had a pyproject.toml for each project they could inherit ruff settings.
  2. The model_signing directory (which is where it currently is in this PR).

For reviewers, I recommend going commit by commit, I tried to organize them in reviewable chunks.

@mihaimaruseac does this address the comments you left in #232?

Doing this because the pylint annotation in https://github.com/sigstore/model-transparency/pull/230 are ignored by flake8.

Release Note

NONE

Documentation

NONE