Skip to content

Commit 22a6ec2

Browse files
committed
ci: Run linters with Python 3.8
We've been trying to create a Python 3.10 environment, and then run mypy in that environment and tell it to make sure that all of the code is correctly typed Python 3.8 code (the minimum version we support). This doesn't work: when we install pytest-memray's dependencies in that Python 3.10 environment, we might install versions of those dependencies that require Python 3.10 and so use Python 3.10 syntax, and if so mypy will fail to parse those files as Python 3.8 code. So, until we drop support for Python 3.8, our linting run needs to install our dependencies in a Python 3.8 environment rather than 3.10, and we need to pin to versions of our linters that are compatible with Python 3.8. Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
1 parent 87966e2 commit 22a6ec2

3 files changed

Lines changed: 27 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,37 @@ jobs:
4646
- name: run test suite ${{ matrix.tox_env }}
4747
run: tox --skip-pkg-install -e ${{ matrix.tox_env }}
4848

49-
check:
50-
name: check ${{ matrix.tox_env }}
49+
docs:
50+
name: check docs
5151
runs-on: ubuntu-22.04
52-
strategy:
53-
fail-fast: false
54-
matrix:
55-
tox_env:
56-
- lint
57-
- docs
5852
steps:
5953
- uses: actions/checkout@v5
6054
- name: setup Python 3.11
6155
uses: actions/setup-python@v6
6256
with:
6357
python-version: "3.11"
58+
- name: install tox
59+
run: python -m pip install tox
60+
- name: install docs dependencies
61+
run: tox -vv --notest -e docs
62+
- name: check docs
63+
run: tox --skip-pkg-install -e docs
64+
65+
lint:
66+
name: lint
67+
runs-on: ubuntu-22.04
68+
steps:
69+
- uses: actions/checkout@v5
70+
# mypy needs to be run with the oldest Python version we support.
71+
- name: setup Python 3.8
72+
uses: actions/setup-python@v6
73+
with:
74+
python-version: "3.8"
6475
- name: Install prettier
6576
run: npm install -g prettier
6677
- name: install tox
6778
run: python -m pip install tox
68-
- name: setup test suite for ${{ matrix.tox_env }}
69-
run: tox -vv --notest -e ${{ matrix.tox_env }}
70-
- name: run test suite ${{ matrix.tox_env }}
71-
run: tox --skip-pkg-install -e ${{ matrix.tox_env }}
79+
- name: install lint dependencies
80+
run: tox -vv --notest -e lint
81+
- name: lint
82+
run: tox --skip-pkg-install -e lint

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ optional-dependencies.docs = [
3131
"towncrier>=22.12",
3232
]
3333
optional-dependencies.lint = [
34-
"black==25.1.0",
34+
"black==24.8.0",
3535
"ruff==0.12.7",
36-
"isort==6.0.1",
37-
"mypy==1.17.1",
36+
"isort==5.13.2",
37+
"mypy==1.14.1",
3838
]
3939
optional-dependencies.test = [
4040
"anyio>=4.4.0",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ commands =
4848

4949
[testenv:lint]
5050
description = lint code in {basepython}
51-
basepython = python3.10
51+
basepython = python3.8
5252
extras =
5353
lint
5454
commands =

0 commit comments

Comments
 (0)