-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove linters from requirements-tests.txt #12725
Conversation
Fixes a CI failure seen in #12725
I'll leave this open for a bit in case this severely breaks the workflow of any other maintainers :-) |
I believe uv supports https://peps.python.org/pep-0723/ , it might help go in that direction by supporting |
yeah, I think it might be quite difficult to keep requirements pins synchronised between our various scripts (and keep the pins up-to-date with renovate) if we have different PEP-723 pins in each script. Call me old-fashioned, but I also just quite like to be able to run scripts with just |
Oh yeah, that would have to be optional. I think if Renovate supports it I might seriously consider it, until then I just wanted to at least put the idea out there. As for whether this breaks my workflow: I very rarely have to call black, ruff, flake8, etc. manually because my editor shows issues in real time and autofixes. (type checkers are different because of our dynamic configs) After typing a command once it stays in my history (thanks powershell 7), so even long commands are just a few keystrokes after the first time. |
…od/typeshed into move-lint-requirements
These days, we do all our linting in CI via pre-commit; linters are only listed in
requirements-tests.txt
for local convenience, as pre-commit uses an isolated virtual environment for each linting tool it executes. But runningpre-commit run -a black
isn't really much more to type thanblack
, and installing all these linters into the same environment is starting to cause issues. (See: the CI failures in #12717.) Flake8-pyi has dropped support for Python 3.8 in its latest version, and other linters are likely to soon follow, but per the consensus in #12716 we probably won't do so until the new year. If we're happy to do our linting via pre-commit locally as well as doing it via pre-commit in CI, that makes the situation caused by some tools dropping support for Python 3.8 quite a lot less problematic.The only linter that I think we do need to keep in
requirements-tests.txt
is Ruff, because we run it as a subprocess fromcreate_baseline_stubs.py
, and we run it in that script with slightly different arguments to the ones we use in our pre-commit config file.If we don't want to go this route, then we can just use environment markers in the
requirements-tests.txt
file to specify that the linting dependencies only need to be installed on Python 3.9+. We did this for a while after flake8 and flake8-pyi dropped support for Python 3.7 (until 487e331), and it worked fine. The main disadvantages of that approach are (1) that it feels like a bit of a hack, and (2) we'll probably run into the same issue again when Python 3.9 goes EOL in around a year's time. This approach solves it for the long term.