10000 chore: constrain deps to maintain py 3.8 support · cloudevents/sdk-python@ed68011 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed68011

Browse files
committed
chore: constrain deps to maintain py 3.8 support
Python 3.8 is unsupported and dependencies (such as pydantic) are now shipping releases that fail to type check with mypy running in 3.8 compatibility mode. We run mypy in py 3.8 compatibility mode, so the mypy tox environments must only use deps that support 3.8. And unit tests run by py 3.8 must only use deps that support 3.8. To constrain the deps for 3.8 support, we use two constraint files, one for general environments that only constrains the dependencies that python 3.8 interpreters use, and another for mypy that constraints the dependencies that all interpreters use. Signed-off-by: Hal Blackburn <hwtb2@cam.ac.uk>
1 parent c144dbb commit ed68011

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

requirements/constraints.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This is a requirements constraint file, see:
2+
# https://pip.pypa.io/en/stable/user_guide/#constraints-files
3+
4+
# sanic stopped supporting 3.8 in 24.12:
5+
# https://sanic.dev/en/release-notes/changelog.html#version-24120-
6+
sanic<24.12.0 ; python_version == '3.8'
7+
8+
# pydantic stopped supporting 3.8 in 2.11.0:
9+
# https://github.com/pydantic/pydantic/releases/tag/v2.11.0
10+
pydantic<2.11.0 ; python_version == '3.8'

requirements/mypy-constraints.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This is a requirements constraint file, see:
2+
# https://pip.pypa.io/en/stable/user_guide/#constraints-files
3+
4+
# Because we run mypy in python 3.8 compatibility mode, dependencies must be
5+
# versions that support 3.8.
6+
7+
# pydantic stopped supporting 3.8 in 2.11.0:
8+
# https://github.com/pydantic/pydantic/releases/tag/v2.11.0
9+
pydantic<2.11.0

requirements/test.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ flake8-print
44
pytest
55
pytest-cov
66
# web app tests
7-
8-
# sanic stopped supporting 3.8 in 24.12:
9-
# https://sanic.dev/en/release-notes/changelog.html#version-24120-
10-
sanic ; python_version >= '3.9'
11-
sanic<24.12.0 ; python_version < '3.9'
12-
7+
sanic
138
sanic-testing
149
aiohttp
1510
Pillow

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ deps =
88
-r{toxinidir}/requirements/test.txt
99
-r{toxinidir}/requirements/publish.txt
1010
setenv =
11+
PIP_CONSTRAINT={toxinidir}/requirements/constraints.txt
1112
PYTESTARGS = -v -s --tb=long --cov=cloudevents --cov-report term-missing --cov-fail-under=95
1213
commands = pytest {env:PYTESTARGS} {posargs}
1314

@@ -33,6 +34,8 @@ commands =
3334

3435
[testenv:mypy]
3536
basepython = python3.11
37+
setenv =
38+
PIP_CONSTRAINT={toxinidir}/requirements/mypy-constraints.txt
3639
deps =
3740
-r{toxinidir}/requirements/mypy.txt
3841
# mypy needs test dependencies to check test modules
@@ -42,6 +45,7 @@ commands = mypy cloudevents
4245
[testenv:mypy-samples-{image,json}]
4346
basepython = python3.11
4447
setenv =
48+
PIP_CONSTRAINT={toxinidir}/requirements/mypy-constraints.txt
4549
mypy-samples-image: SAMPLE_DIR={toxinidir}/samples/http-image-cloudevents
4650
mypy-samples-json: SAMPLE_DIR={toxinidir}/samples/http-json-cloudevents
4751
deps =

0 commit comments

Comments
 (0)
0