Skip to content

Commit

Permalink
Centralize Python linter/formatter requirements
Browse files Browse the repository at this point in the history
These are currently duplicated all over the codebase, often with mismatched
constraints. Put them all in one requirements file instead.

Fix a few minor issues while I'm at it:

* Constrain black to the current major version to avoid New Year surprises
  (black can change styles between major versions). Constrain isort too,
  just in case.

* Remove usages of `egrep`, which is deprecated (and unnecessary here).
  • Loading branch information
SpecLad committed Dec 20, 2024
1 parent 54534e8 commit 60b1c93
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

- name: Run checks
run: |
pipx install $(grep "^black" ./cvat-cli/requirements/development.txt)
pipx install $(grep "^black" ./dev/requirements.txt)
echo "Black version: $(black --version)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
UPDATED_DIRS="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $UPDATED_DIRS ]]; then
pipx install $(egrep "isort.*" ./cvat-cli/requirements/development.txt)
pipx install $(grep "^isort" ./dev/requirements.txt)
echo "isort version: $(isort --version-number)"
echo "The dirs will be checked: $UPDATED_DIRS"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
CHANGED_FILES="${{steps.files.outputs.all_changed_files}}"
if [[ ! -z $CHANGED_FILES ]]; then
pipx install $(egrep "^pylint==" ./cvat/requirements/development.txt)
pipx install $(grep "^pylint==" ./dev/requirements.txt)
pipx inject pylint \
$(egrep "^pylint-.+==" ./cvat/requirements/development.txt) \
$(egrep "^django==" ./cvat/requirements/base.txt)
$(grep "^pylint-.\+==" ./dev/requirements.txt) \
$(grep "^django==" ./cvat/requirements/base.txt)
echo "Pylint version: "$(pylint --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
Expand Down
5 changes: 0 additions & 5 deletions cvat-cli/requirements/development.txt

This file was deleted.

1 change: 0 additions & 1 deletion cvat-sdk/gen/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# can't have a dependency on base.txt, because it depends on the generated file

inflection >= 0.5.1
isort>=5.10.1
ruamel.yaml>=0.17.21
2 changes: 0 additions & 2 deletions cvat/requirements/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
-r development.txt
-r production.txt
-r testing.txt

# The following packages are considered to be unsafe in a requirements file:
4 changes: 0 additions & 4 deletions cvat/requirements/development.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
-r base.in

black>=24.1
django-extensions==3.0.8
django-silk==5.*
pylint-django==2.5.3
pylint-plugin-utils==0.7
pylint==2.14.5
rope==0.17.0
snakeviz==2.1.0
44 changes: 2 additions & 42 deletions cvat/requirements/development.txt
Original file line number Diff line number Diff line change
@@ -1,66 +1,26 @@
# SHA1:b71f4fe955f645187b7ccdf82b05f6a8d61eb3ab
# SHA1:cd8d0825dc4cfe37b22a489422105acba5483fe4
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# pip-compile-multi
#
-r base.txt
astroid==2.11.7
# via pylint
autopep8==2.3.1
# via django-silk
black==24.10.0
# via -r cvat/requirements/development.in
dill==0.3.9
# via pylint
django-extensions==3.0.8
# via -r cvat/requirements/development.in
django-silk==5.3.2
# via -r cvat/requirements/development.in
gprof2dot==2024.6.6
# via django-silk
isort==5.13.2
# via pylint
lazy-object-proxy==1.10.0
# via astroid
mccabe==0.7.0
# via pylint
mypy-extensions==1.0.0
# via black
pathspec==0.12.1
# via black
platformdirs==4.3.6
# via
# black
# pylint
pycodestyle==2.12.1
# via autopep8
pylint==2.14.5
# via
# -r cvat/requirements/development.in
# pylint-django
# pylint-plugin-utils
pylint-django==2.5.3
# via -r cvat/requirements/development.in
pylint-plugin-utils==0.7
# via
# -r cvat/requirements/development.in
# pylint-django
rope==0.17.0
# via -r cvat/requirements/development.in
snakeviz==2.1.0
# via -r cvat/requirements/development.in
tomli==2.2.1
# via
# autopep8
# black
# pylint
tomlkit==0.13.2
# via pylint
# via autopep8
tornado==6.4.2
# via snakeviz

# The following packages are considered to be unsafe in a requirements file:
setuptools==75.6.0
# via astroid
2 changes: 0 additions & 2 deletions cvat/requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ lupa==1.14.1
# via fakeredis
sortedcontainers==2.4.0
# via fakeredis

# The following packages are considered to be unsafe in a requirements file:
5 changes: 5 additions & 0 deletions dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
black==24.*
isort==5.*
pylint-django==2.5.3
pylint-plugin-utils==0.7
pylint==2.14.5
1 change: 0 additions & 1 deletion site/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
gitpython
inflection >= 0.5.1
isort>=5.10.1
packaging
toml

0 comments on commit 60b1c93

Please sign in to comment.