Skip to content

Commit 3de716b

Browse files
Update deps for python311 (#853)
* Update dependencies
1 parent 3ce5d0f commit 3de716b

34 files changed

+159
-300
lines changed

.circleci/config.yml

+2-31
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ version: 2
22

33
defaults: &defaults
44
docker:
5-
- image: circleci/python:3.9.5
5+
- image: cimg/python:3.11.1
66
working_directory: ~/project
77

88
prepare_venv: &prepare_venv
99
run:
1010
name: Create venv
1111
command: |
12-
python3 -m venv venv
12+
python -m venv venv
1313
source venv/bin/activate
1414
pip install --upgrade pip
1515
1616
prepare_tox: &prepare_tox
1717
run:
1818
name: Install tox
1919
command: |
20-
sudo pip install --upgrade pip
2120
pip install --user tox
2221
2322
fetch_data: &fetch_data
@@ -95,20 +94,6 @@ jobs:
9594
command: |
9695
cd section-08-deploying-with-containers && make release-heroku
9796
98-
test_regression_model_py36:
99-
docker:
100-
- image: circleci/python:3.6.9
101-
working_directory: ~/project/packages/regression_model
102-
steps:
103-
- checkout:
104-
path: ~/project
105-
- run:
106-
name: Run tests with Python 3.6
107-
command: |
108-
sudo pip install --upgrade pip
109-
pip install --user tox
110-
tox -e py36
111-
11297
test_regression_model_py37:
11398
docker:
11499
- image: circleci/python:3.7.6
@@ -137,20 +122,6 @@ jobs:
137122
pip install --user tox
138123
tox -e py38
139124
140-
test_ml_api_py36:
141-
docker:
142-
- image: circleci/python:3.6.9
143-
working_directory: ~/project/packages/ml_api
144-
steps:
145-
- checkout:
146-
path: ~/project
147-
- run:
148-
name: Run API tests with Python 3.6
149-
command: |
150-
sudo pip install --upgrade pip
151-
pip install --user tox
152-
tox -e py36
153-
154125
test_ml_api_py37:
155126
docker:
156127
- image: circleci/python:3.7.6

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ celerybeat-schedule
8585
.env
8686
.venv
8787
env/
88+
env39/
89+
env311/
8890
venv/
8991
ENV/
9092
env.bak/

assignment-section-05/pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ filterwarnings = [
3939
]
4040

4141
[tool.black]
42-
target-version = ['py36']
42+
target-version = ['py311']
4343

4444
[tool.isort]
4545
profile = "black"
4646
line_length = 100
4747
lines_between_sections = 1
48-
known_first_party = "sentry"
4948
skip = "migrations"
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# We use compatible release functionality (see PEP 440 here: https://www.python.org/dev/peps/pep-0440/#compatible-release)
22
# to specify acceptable version ranges of our project dependencies. This gives us the flexibility to keep up with small
33
# updates/fixes, whilst ensuring we don't install a major update which could introduce backwards incompatible changes.
4-
numpy>=1.20.0,<1.21.0
5-
pandas>=1.3.5,<1.4.0
6-
pydantic>=1.8.1,<1.9.0
7-
scikit-learn>=0.24.2,<0.25.0
8-
strictyaml>=1.3.2,<1.4.0
9-
ruamel.yaml==0.16.12
10-
feature-engine>=1.0.2,<1.3.0
11-
joblib>=1.0.1,<1.1.0
4+
numpy>=1.21.0,<2.0.0
5+
pandas>=1.3.5,<2.0.0
6+
pydantic>=1.8.1,<2.0.0
7+
scikit-learn>=1.1.3,<2.0.0
8+
strictyaml>=1.3.2,<2.0.0
9+
ruamel.yaml>=0.16.12,<1.0.0
10+
feature-engine>=1.0.2,<2.0.0
11+
joblib>=1.0.1,<2.0.0
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
-r requirements.txt
22

33
# testing requirements
4-
pytest>=6.2.3,<6.3.0
5-
6-
# repo maintenance tooling
7-
black==20.8b1
8-
flake8>=3.9.0,<3.10.0
9-
mypy==0.812
10-
isort==5.8.0
4+
pytest>=7.2.0,<8.0.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# repo maintenance tooling
2+
black>=22.12.0,<23.0.0
3+
flake8>=6.0.0,<7.0.0
4+
mypy>=0.991,<1.0.0
5+
isort>=5.11.4,<6.0.0

assignment-section-05/setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def list_reqs(fname="requirements.txt"):
6363
"Programming Language :: Python :: 3.7",
6464
"Programming Language :: Python :: 3.8",
6565
"Programming Language :: Python :: 3.9",
66+
"Programming Language :: Python :: 3.10",
67+
"Programming Language :: Python :: 3.11",
6668
"Programming Language :: Python :: Implementation :: CPython",
6769
"Programming Language :: Python :: Implementation :: PyPy",
6870
],

assignment-section-05/tox.ini

+10-28
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
[tox]
11-
envlist = test_package, typechecks, stylechecks, lint
11+
envlist = test_package, checks
1212
skipsdist = True
1313

1414
[testenv]
@@ -29,47 +29,29 @@ commands=
2929
-vv \
3030
{posargs:tests/}
3131

32+
3233
[testenv:train]
3334
envdir = {toxworkdir}/test_package
35+
3436
deps =
35-
{[testenv:test_package]deps}
37+
{[testenv:test_package]deps}
3638

3739
setenv =
3840
{[testenv:test_package]setenv}
39-
4041
commands=
4142
python classification_model/train_pipeline.py
4243

4344

44-
[testenv:typechecks]
45-
envdir = {toxworkdir}/test_package
46-
45+
[testenv:checks]
46+
envdir = {toxworkdir}/checks
4747
deps =
48-
{[testenv:test_package]deps}
49-
50-
commands = {posargs:mypy classification_model}
51-
52-
53-
[testenv:stylechecks]
54-
envdir = {toxworkdir}/test_package
55-
56-
deps =
57-
{[testenv:test_package]deps}
58-
59-
commands = {posargs:flake8 classification_model tests}
60-
61-
62-
[testenv:lint]
63-
envdir = {toxworkdir}/test_package
64-
65-
deps =
66-
{[testenv:test_package]deps}
67-
48+
-r{toxinidir}/requirements/typing_requirements.txt
6849
commands =
50+
flake8 classification_model tests
6951
isort classification_model tests
7052
black classification_model tests
71-
mypy classification_model
72-
flake8 classification_model
53+
{posargs:mypy classification_model}
54+
7355

7456
[flake8]
7557
exclude = .git,env

section-05-production-model-package/pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ filterwarnings = [
3939
]
4040

4141
[tool.black]
42-
target-version = ['py37']
42+
target-version = ['py311']
4343

4444
[tool.isort]
4545
profile = "black"
4646
line_length = 100
4747
lines_between_sections = 1
48-
known_first_party = "sentry"
4948
skip = "migrations"

section-05-production-model-package/regression_model/config/core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import Dict, List, Sequence
2+
from typing import Dict, List, Optional, Sequence
33

44
from pydantic import BaseModel
55
from strictyaml import YAML, load
@@ -69,7 +69,7 @@ def find_config_file() -> Path:
6969
raise Exception(f"Config not found at {CONFIG_FILE_PATH!r}")
7070

7171

72-
def fetch_config_from_yaml(cfg_path: Path = None) -> YAML:
72+
def fetch_config_from_yaml(cfg_path: Optional[Path] = None) -> YAML:
7373
"""Parse YAML containing the package configuration."""
7474

7575
if not cfg_path:
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# We use compatible release functionality (see PEP 440 here: https://www.python.org/dev/peps/pep-0440/#compatible-release)
22
# to specify acceptable version ranges of our project dependencies. This gives us the flexibility to keep up with small
33
# updates/fixes, whilst ensuring we don't install a major update which could introduce backwards incompatible changes.
4-
numpy>=1.20.0,<1.21.0
5-
pandas>=1.3.5,<1.4.0
6-
pydantic>=1.8.1,<1.9.0
7-
scikit-learn>=1.0.2,<1.1.0
8-
strictyaml>=1.3.2,<1.4.0
9-
ruamel.yaml==0.16.12
10-
feature-engine>=1.0.2,<1.1.0
11-
joblib>=1.0.1,<1.1.0
4+
numpy>=1.21.0,<2.0.0
5+
pandas>=1.3.5,<2.0.0
6+
pydantic>=1.8.1,<2.0.0
7+
scikit-learn>=1.1.3,<2.0.0
8+
strictyaml>=1.3.2,<2.0.0
9+
ruamel.yaml>=0.16.12,<1.0.0
10+
feature-engine>=1.0.2,<2.0.0
11+
joblib>=1.0.1,<2.0.0
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
-r requirements.txt
22

33
# testing requirements
4-
pytest>=6.2.3,<6.3.0
5-
6-
# repo maintenance tooling
7-
black>=22.0.0,<23.0.0
8-
flake8>=3.9.0,<3.10.0
9-
mypy==0.812
10-
isort==5.8.0
4+
pytest>=7.2.0,<8.0.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# repo maintenance tooling
2+
black>=22.12.0,<23.0.0
3+
flake8>=6.0.0,<7.0.0
4+
mypy>=0.991,<1.0.0
5+
isort>=5.11.4,<6.0.0

section-05-production-model-package/tox.ini

+15-33
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@
88

99

1010
[tox]
11-
envlist = test_package, typechecks, lint, stylechecks
11+
min_version = 4
12+
envlist = test_package, checks
1213
skipsdist = True
1314

1415
[testenv]
16+
basepython = python
1517
install_command = pip install {opts} {packages}
16-
17-
[testenv:test_package]
18-
deps =
19-
-rrequirements/test_requirements.txt
18+
whitelist_externals = train
2019

2120
setenv =
2221
PYTHONPATH=.
2322
PYTHONHASHSEED=0
2423

24+
[testenv:test_package]
25+
envdir = {toxworkdir}/test_package
26+
deps =
27+
-r{toxinidir}/requirements/test_requirements.txt
2528
commands=
2629
python regression_model/train_pipeline.py
2730
pytest \
@@ -32,42 +35,21 @@ commands=
3235
[testenv:train]
3336
envdir = {toxworkdir}/test_package
3437
deps =
35-
{[testenv:test_package]deps}
36-
37-
setenv =
38-
{[testenv:test_package]setenv}
39-
38+
{[testenv:test_package]deps}
4039
commands=
4140
python regression_model/train_pipeline.py
4241

4342

44-
[testenv:typechecks]
45-
envdir = {toxworkdir}/test_package
46-
43+
[testenv:checks]
44+
envdir = {toxworkdir}/checks
4745
deps =
48-
{[testenv:test_package]deps}
49-
50-
commands = {posargs:mypy regression_model}
51-
52-
53-
[testenv:stylechecks]
54-
envdir = {toxworkdir}/test_package
55-
56-
deps =
57-
{[testenv:test_package]deps}
58-
59-
commands = {posargs:flake8 regression_model tests}
60-
61-
62-
[testenv:lint]
63-
envdir = {toxworkdir}/test_package
64-
65-
deps =
66-
{[testenv:test_package]deps}
67-
46+
-r{toxinidir}/requirements/typing_requirements.txt
6847
commands =
48+
flake8 regression_model tests
6949
isort regression_model tests
7050
black regression_model tests
51+
{posargs:mypy regression_model}
52+
7153

7254
[flake8]
7355
exclude = .git,env
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
uvicorn>=0.16.0,<0.18.0
2-
fastapi>=0.64.0,<1.0.0
1+
uvicorn>=0.20.0,<0.30.0
2+
fastapi>=0.88.0,<1.0.0
33
python-multipart>=0.0.5,<0.1.0
4-
pydantic>=1.8.1,<1.10.0
5-
typing_extensions>=3.7.4,<4.0.0
6-
loguru>=0.5.3,<0.6.0
4+
pydantic>=1.10.4,<1.12.0
5+
typing_extensions>=4.2.0,<5.0.0
6+
loguru>=0.5.3,<1.0.0
77
# We will explain this in the course
8-
tid-regression-model==3.0.3
8+
tid-regression-model>=3.2.0
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.9.5
1+
python-3.11.1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
-r requirements.txt
22

33
# testing requirements
4-
pytest>=6.2.3,<6.3.0
5-
requests>=2.23.0,<2.24.0
6-
7-
# repo maintenance tooling
8-
black>=22.0.0,<23.0.0
9-
flake8>=3.9.0,<3.10.0
10-
mypy==0.812
11-
isort==5.8.0
4+
pytest>=7.2.0,<8.0.0
5+
requests>=2.28.0,<2.50.0
6+
httpx>=0.23.2,<0.50.0

0 commit comments

Comments
 (0)