Skip to content

Commit

Permalink
Update deps for python311 (#853)
Browse files Browse the repository at this point in the history
* Update dependencies
  • Loading branch information
ChristopherGS authored Jan 15, 2023
1 parent 3ce5d0f commit 3de716b
Show file tree
Hide file tree
Showing 34 changed files with 159 additions and 300 deletions.
33 changes: 2 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ version: 2

defaults: &defaults
docker:
- image: circleci/python:3.9.5
- image: cimg/python:3.11.1
working_directory: ~/project

prepare_venv: &prepare_venv
run:
name: Create venv
command: |
python3 -m venv venv
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
prepare_tox: &prepare_tox
run:
name: Install tox
command: |
sudo pip install --upgrade pip
pip install --user tox
fetch_data: &fetch_data
Expand Down Expand Up @@ -95,20 +94,6 @@ jobs:
command: |
cd section-08-deploying-with-containers && make release-heroku
test_regression_model_py36:
docker:
- image: circleci/python:3.6.9
working_directory: ~/project/packages/regression_model
steps:
- checkout:
path: ~/project
- run:
name: Run tests with Python 3.6
command: |
sudo pip install --upgrade pip
pip install --user tox
tox -e py36
test_regression_model_py37:
docker:
- image: circleci/python:3.7.6
Expand Down Expand Up @@ -137,20 +122,6 @@ jobs:
pip install --user tox
tox -e py38
test_ml_api_py36:
docker:
- image: circleci/python:3.6.9
working_directory: ~/project/packages/ml_api
steps:
- checkout:
path: ~/project
- run:
name: Run API tests with Python 3.6
command: |
sudo pip install --upgrade pip
pip install --user tox
tox -e py36
test_ml_api_py37:
docker:
- image: circleci/python:3.7.6
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ celerybeat-schedule
.env
.venv
env/
env39/
env311/
venv/
ENV/
env.bak/
Expand Down
3 changes: 1 addition & 2 deletions assignment-section-05/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ filterwarnings = [
]

[tool.black]
target-version = ['py36']
target-version = ['py311']

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

# testing requirements
pytest>=6.2.3,<6.3.0

# repo maintenance tooling
black==20.8b1
flake8>=3.9.0,<3.10.0
mypy==0.812
isort==5.8.0
pytest>=7.2.0,<8.0.0
5 changes: 5 additions & 0 deletions assignment-section-05/requirements/typing_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# repo maintenance tooling
black>=22.12.0,<23.0.0
flake8>=6.0.0,<7.0.0
mypy>=0.991,<1.0.0
isort>=5.11.4,<6.0.0
2 changes: 2 additions & 0 deletions assignment-section-05/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def list_reqs(fname="requirements.txt"):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
38 changes: 10 additions & 28 deletions assignment-section-05/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


[tox]
envlist = test_package, typechecks, stylechecks, lint
envlist = test_package, checks
skipsdist = True

[testenv]
Expand All @@ -29,47 +29,29 @@ commands=
-vv \
{posargs:tests/}


[testenv:train]
envdir = {toxworkdir}/test_package

deps =
{[testenv:test_package]deps}
{[testenv:test_package]deps}

setenv =
{[testenv:test_package]setenv}

commands=
python classification_model/train_pipeline.py


[testenv:typechecks]
envdir = {toxworkdir}/test_package

[testenv:checks]
envdir = {toxworkdir}/checks
deps =
{[testenv:test_package]deps}

commands = {posargs:mypy classification_model}


[testenv:stylechecks]
envdir = {toxworkdir}/test_package

deps =
{[testenv:test_package]deps}

commands = {posargs:flake8 classification_model tests}


[testenv:lint]
envdir = {toxworkdir}/test_package

deps =
{[testenv:test_package]deps}

-r{toxinidir}/requirements/typing_requirements.txt
commands =
flake8 classification_model tests
isort classification_model tests
black classification_model tests
mypy classification_model
flake8 classification_model
{posargs:mypy classification_model}


[flake8]
exclude = .git,env
Expand Down
3 changes: 1 addition & 2 deletions section-05-production-model-package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ filterwarnings = [
]

[tool.black]
target-version = ['py37']
target-version = ['py311']

[tool.isort]
profile = "black"
line_length = 100
lines_between_sections = 1
known_first_party = "sentry"
skip = "migrations"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Dict, List, Sequence
from typing import Dict, List, Optional, Sequence

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


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

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

# testing requirements
pytest>=6.2.3,<6.3.0

# repo maintenance tooling
black>=22.0.0,<23.0.0
flake8>=3.9.0,<3.10.0
mypy==0.812
isort==5.8.0
pytest>=7.2.0,<8.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# repo maintenance tooling
black>=22.12.0,<23.0.0
flake8>=6.0.0,<7.0.0
mypy>=0.991,<1.0.0
isort>=5.11.4,<6.0.0
48 changes: 15 additions & 33 deletions section-05-production-model-package/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@


[tox]
envlist = test_package, typechecks, lint, stylechecks
min_version = 4
envlist = test_package, checks
skipsdist = True

[testenv]
basepython = python
install_command = pip install {opts} {packages}

[testenv:test_package]
deps =
-rrequirements/test_requirements.txt
whitelist_externals = train

setenv =
PYTHONPATH=.
PYTHONHASHSEED=0

[testenv:test_package]
envdir = {toxworkdir}/test_package
deps =
-r{toxinidir}/requirements/test_requirements.txt
commands=
python regression_model/train_pipeline.py
pytest \
Expand All @@ -32,42 +35,21 @@ commands=
[testenv:train]
envdir = {toxworkdir}/test_package
deps =
{[testenv:test_package]deps}

setenv =
{[testenv:test_package]setenv}

{[testenv:test_package]deps}
commands=
python regression_model/train_pipeline.py


[testenv:typechecks]
envdir = {toxworkdir}/test_package

[testenv:checks]
envdir = {toxworkdir}/checks
deps =
{[testenv:test_package]deps}

commands = {posargs:mypy regression_model}


[testenv:stylechecks]
envdir = {toxworkdir}/test_package

deps =
{[testenv:test_package]deps}

commands = {posargs:flake8 regression_model tests}


[testenv:lint]
envdir = {toxworkdir}/test_package

deps =
{[testenv:test_package]deps}

-r{toxinidir}/requirements/typing_requirements.txt
commands =
flake8 regression_model tests
isort regression_model tests
black regression_model tests
{posargs:mypy regression_model}


[flake8]
exclude = .git,env
Expand Down
12 changes: 6 additions & 6 deletions section-06-model-serving-api/house-prices-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
uvicorn>=0.16.0,<0.18.0
fastapi>=0.64.0,<1.0.0
uvicorn>=0.20.0,<0.30.0
fastapi>=0.88.0,<1.0.0
python-multipart>=0.0.5,<0.1.0
pydantic>=1.8.1,<1.10.0
typing_extensions>=3.7.4,<4.0.0
loguru>=0.5.3,<0.6.0
pydantic>=1.10.4,<1.12.0
typing_extensions>=4.2.0,<5.0.0
loguru>=0.5.3,<1.0.0
# We will explain this in the course
tid-regression-model==3.0.3
tid-regression-model>=3.2.0
2 changes: 1 addition & 1 deletion section-06-model-serving-api/house-prices-api/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.9.5
python-3.11.1
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
-r requirements.txt

# testing requirements
pytest>=6.2.3,<6.3.0
requests>=2.23.0,<2.24.0

# repo maintenance tooling
black>=22.0.0,<23.0.0
flake8>=3.9.0,<3.10.0
mypy==0.812
isort==5.8.0
pytest>=7.2.0,<8.0.0
requests>=2.28.0,<2.50.0
httpx>=0.23.2,<0.50.0
Loading

0 comments on commit 3de716b

Please sign in to comment.