Closed perlinm closed 1 month ago
Any idea why the qiskit notebook check is failing? I don't think this PR should have affected that.
It's probably failing because of https://github.com/Infleqtion/client-superstaq/issues/897. Though we can still merge after @vtomole adjusts the requirements I think
@perlinm I've adjusted the requirements.
Ruff (GitHub) is a Python linter and formatter that plays the role of
black
,isort
,flake8
, andpylint
, and does it all much faster (for whatever that is worth). This PR adds the option to useruff
in place of these tools tochecks-superstaq
.Specifically, this PR functionally adds:
ruff_format_.py
(which aspires to replace one day replaceformat_.py
)ruff_lint_.py
(which aspires to one day replaceflake8_.py
andpylint_.py
, at which point it can be renamed to (say)lint_.py
).--ruff
flag tochecks_superstaq.all_
to useruff
instead of the previous formatters+linters.Note that
ruff_format_.py
has a--fix
option instead of--apply
for parity with the--fix
option recognized byruff check
(which is called byruff_lint_.py
). That's becauseruff format
refuses to change a program's AST, so it's not allowed to change import order. Import order therefore has to be handled byruff check
with./checks/ruff_lint_.py --fix
. (Incidentally, mayberuff_lint_.py
should be renamed toruff_check_
because it callsruff check
? But then if+when this repo switches to using ruff it will feel silly to callchecks/check_.py
. Or maybe if+whenruff
takes over we can haveruff_format.py
andruff_check.py
?)ruff
comes with many reasonable defaults, so I did not need to add much topyproject.toml
. Having said that,checks-superstaq
has extensive configuration offlake8
andpylint
, and I am sure that not all of these linting rules are enforced by ruff. I leave it up to you all @Infleqtion to make the call on whether it's okay to merge in a "partial" switch to ruff (at the cost of having duplicate formatting/linting tools in the repo) vs. whether you'd like to do one big switch (configs and all).At the moment, all checks of
ruff_lint_.py
pass, andruff_format_.py
asks for a few minor formatting changes. The requested formatting changes are not included in this PR (though if I do make the changes,checks/format_.py
is happy with all except those made to one.pynb
file).