Skip to content

Commit

Permalink
Fix linting steps etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
haukex committed Oct 3, 2024
1 parent 6b59877 commit 128cc8c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jobs:
matrix:
os: [Ubuntu, Windows, macOS]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
#TODO Later: The workaround for pylint+3.13.0rc3 isn't working on macOS for some reason
# remove the following exception when that gets fixed (see pylint step in Makefile)
exclude:
- os: macOS
python-version: "3.13"
runs-on: ${{ matrix.os }}-latest
# Reminder: Keep in sync with dev/local-actions.sh
steps:
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# https://www.gnu.org/software/make/manual/make.html

py_code_locs = unzipwalk tests docs/*.py docs/_ext/*.py
# Hint: $(filter-out whatever,$(py_code_locs))
# Remember to keep in sync with GitHub Actions workflows:
requirement_txts = requirements.txt dev/requirements.txt docs/requirements.txt
perm_checks = ./* .gitignore .vscode .github
Expand Down Expand Up @@ -34,7 +35,7 @@ installdeps: ## Install project dependencies
@set -euxo pipefail
$(PYTHON3BIN) -m pip install --upgrade --upgrade-strategy=eager --no-warn-script-location pip wheel
$(PYTHON3BIN) -m pip install --upgrade --upgrade-strategy=eager --no-warn-script-location $(foreach x,$(requirement_txts),-r $(x))
pre-commit install -c dev/pre-commit.yml
$(PYTHON3BIN) -m pre_commit install -c dev/pre-commit.yml
# for modules/packages:
# $(PYTHON3BIN) -m pip install --editable .

Expand Down Expand Up @@ -77,16 +78,18 @@ ver-checks: ## Checks that depend on the Python version
@set -euxo pipefail
# https://microsoft.github.io/pyright/#/command-line
npx pyright --project pyproject.toml --pythonpath "$$( $(PYTHON3BIN) -c 'import sys; print(sys.executable)' )" $(py_code_locs)
mypy --config-file pyproject.toml $(py_code_locs)
$(PYTHON3BIN) -m mypy --config-file pyproject.toml $(py_code_locs)
# Note I'm not sure if the following are actually version-dependent, but because they parse the Python code, I'll leave them here.
flake8 --toml-config=pyproject.toml $(py_code_locs)
pylint --rcfile=pyproject.toml --recursive=y $(py_code_locs)
$(PYTHON3BIN) -m flake8 --toml-config=pyproject.toml $(py_code_locs)
#TODO Later: The following is a workaround for https://github.com/pylint-dev/pylint/issues/10000 (on Python 3.13.0rc3), remove when fixed
ISPY13RC="$$( $(PYTHON3BIN) --version | perl -ne 'print "yes" if /Python 3\.13\.0rc/' )"
$(PYTHON3BIN) -m pylint --rcfile=pyproject.toml $${ISPY13RC:+"--disable=no-name-in-module"} --recursive=y $(py_code_locs)

other-checks: ## Checks not depending on the Python version
@set -euxo pipefail
pre-commit run -c dev/pre-commit.yml --all-files
$(PYTHON3BIN) -m pre_commit run -c dev/pre-commit.yml --all-files
# note the following is on one line b/c GitHub macOS Action Runners are running bash 3.2 and the multiline version didn't work there...
for REQ in $(requirement_txts); do pur --skip-gt --dry-run-changed --nonzero-exit-code -r "$$REQ"; done
for REQ in $(requirement_txts); do $(PYTHON3BIN) -m pur --skip-gt --dry-run-changed --nonzero-exit-code -r "$$REQ"; done

unittest: ## Run unit tests
@PYTHONDEVMODE=1 PYTHONWARNINGS=error PYTHONWARNDEFAULTENCODING=1 $(PYTHON3BIN) -m unittest -v
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tomli == 2.0.2
sphinx == 7.4.7
sphinx >= 7.4.7
sphinx-markdown-builder == 0.6.7
types-docutils == 0.21.0.20240907

0 comments on commit 128cc8c

Please sign in to comment.