Skip to content

Commit

Permalink
upgrade to python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Nov 15, 2024
1 parent caeb598 commit 37a1f5e
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10@sha256:ef9cc483a593c95e1e83f2cf00b6a0e1ec7df43344416a41ccb3a88aef27beac
FROM mcr.microsoft.com/vscode/devcontainers/python:3.12

ARG KUBENS_VERSION="0.9.4"
ENV POETRY_VERSION="1.7.1"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- name: Install libcurl
run: sudo apt-get update && sudo apt-get install libssl-dev libcurl4-openssl-dev
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0
with:
python-version: '3.10'
python-version: '3.12'
- name: Upgrade pip
run: python -m pip install --upgrade pip
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- name: Install libcurl
run: sudo apt-get update && sudo apt-get install libssl-dev libcurl4-openssl-dev
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0
with:
python-version: '3.10'
python-version: '3.12'
- name: Upgrade pip
run: python -m pip install --upgrade pip
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
working-directory: ${{ github.workspace }}
shell: bash
run: |
mkdir -p "${{ github.workspace }}/env/" && cp -fR $(poetry env list | poetry env info -p)/lib/python3.10/site-packages "${{ github.workspace }}/env/"
mkdir -p "${{ github.workspace }}/env/" && cp -fR $(poetry env list | poetry env info -p)/lib/python3.12/site-packages "${{ github.workspace }}/env/"
- name: Install development .env file
working-directory: ${{ github.workspace }}
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Run `make run-celery-local` or `make run-celery-local-filtered`. Note that the "

### Python version

This codebase is Python 3 only. At the moment we run 3.10.8 in production. You will run into problems if you try to use Python 3.4 or older.
This codebase is Python 3 only. At the moment we run 3.12.6 in production. You will run into problems if you try to use Python 3.4 or older.

### To run Performance tests

Expand Down Expand Up @@ -121,7 +121,7 @@ createuser -l -s postgres

__Problem__ : `E999 SyntaxError: invalid syntax` when running `flake8`

__Solution__ : Check that you are in your correct virtualenv, with python 3.10
__Solution__ : Check that you are in your correct virtualenv, with python 3.12

---

Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-alpine3.16@sha256:afe68972cc00883d70b3760ee0ffbb7375cf09706c122dda7063ffe64c5be21b
FROM python:3.12-alpine3.20

ENV PYTHONDONTWRITEBYTECODE 1
ENV APP_VENV="/app/.venv"
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile.lambda
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.10-alpine3.16@sha256:afe68972cc00883d70b3760ee0ffbb7375cf09706c122dda7063ffe64c5be21b
FROM python:3.12-alpine3.20

ENV PYTHONPATH "${PYTHONPATH}:/opt/python/lib/python3.10/site-packages"
ENV PYTHONPATH "${PYTHONPATH}:/opt/python/lib/python3.12/site-packages"
ENV PYTHONDONTWRITEBYTECODE 1
ENV TASK_ROOT /app
ENV APP_VENV="${TASK_ROOT}/.venv"
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Heavily inspired from Dockerfile, this one also install requirements_for_test.txt

FROM python:3.10-alpine@sha256:7edffe5acc6a2c4c009fece2fbdc85f04fde4c8481202473b880ef3f8fbb2939
FROM python:3.12-alpine3.20

ENV PYTHONDONTWRITEBYTECODE 1
ENV POETRY_VERSION "1.7.1"
Expand Down
2 changes: 1 addition & 1 deletion local/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-alpine@sha256:7edffe5acc6a2c4c009fece2fbdc85f04fde4c8481202473b880ef3f8fbb2939
FROM python:3.12-alpine3.20

ENV PYTHONDONTWRITEBYTECODE 1
ENV POETRY_VERSION "1.7.1"
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.10
python_version = 3.12

[mypy-pytest.*]
ignore_missing_imports = True
Expand Down
221 changes: 90 additions & 131 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 130
target-version = ['py310']
target-version = ['py312']
include = '(app|migrations|tests)/.*\.pyi?$'

[tool.poetry]
Expand All @@ -20,7 +20,7 @@ requires = ["poetry>=1.3.2"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "~3.10.9"
python = "~3.12.6"
apig-wsgi = "2.18.0"
boto = "2.49.0"
cffi = "1.17.0"
Expand Down Expand Up @@ -65,11 +65,11 @@ Werkzeug = "3.0.4"
MarkupSafe = "2.1.5"
# REVIEW: v2 is using sha512 instead of sha1 by default (in v1)
itsdangerous = "2.2.0"
notifications-utils = { git = "https://github.com/cds-snc/notifier-utils.git", tag = "52.3.6" }
notifications-utils = { git = "https://github.com/cds-snc/notifier-utils.git", branch = "task/pythonupgrade"}

# rsa = "4.9 # awscli 1.22.38 depends on rsa<4.8
typing-extensions = "4.12.2"
greenlet = "2.0.2"
greenlet = "3.1.1"
simple-salesforce = "^1.12.3"

# Pinned dependencies
Expand Down
2 changes: 1 addition & 1 deletion scripts/enlarge_db/enlarge_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def create_notifications(n: int, ref: str) -> List[NotificationHistory]:
print(f"Error adding notifications: {e}")
db.session.rollback()
sys.exit(1)
print(f"Done {notifications_done+len(notifications)} / {args.notifications}")
print(f"Done {notifications_done + len(notifications)} / {args.notifications}")
2 changes: 1 addition & 1 deletion tests-perf/ops/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-alpine3.16@sha256:afe68972cc00883d70b3760ee0ffbb7375cf09706c122dda7063ffe64c5be21b
FROM python:3.12-alpine3.20

ENV PYTHONDONTWRITEBYTECODE 1
ENV POETRY_VERSION "1.7.1"
Expand Down

0 comments on commit 37a1f5e

Please sign in to comment.