diff --git a/app/Dockerfile b/app/Dockerfile index fd017c5..66a3650 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -4,7 +4,9 @@ # The build stage that will be used to deploy to the various environments # needs to be called `release` in order to integrate with the repo's # top-level Makefile -FROM python:3-slim AS base +FROM python:3.12-slim AS base +# See /docs/app/README.md#Upgrading Python +# for details on upgrading your Python version # Install poetry, the package manager. # https://python-poetry.org diff --git a/app/poetry.lock b/app/poetry.lock index c5b0b70..e51bc8e 100644 --- a/app/poetry.lock +++ b/app/poetry.lock @@ -949,7 +949,7 @@ files = [ [package.dependencies] marshmallow = [ - {version = ">=3.13.0,<4.0", optional = true, markers = "python_version < \"3.7\" or extra != \"enum\""}, + {version = ">=3.13.0,<4.0"}, {version = ">=3.18.0,<4.0", optional = true, markers = "python_version >= \"3.7\" and extra == \"enum\""}, ] typeguard = {version = ">=2.4.1,<4.0.0", optional = true, markers = "extra == \"union\""} @@ -1981,5 +1981,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = "^3.12" -content-hash = "259e2bd37870236ef86dc5893950acf19912b7468e906dc61f78436ea5f34796" +python-versions = "~3.12" +content-hash = "885d91299426a19ef533e20f8d85a652c639eb031091bbb9501da467c374e873" diff --git a/app/pyproject.toml b/app/pyproject.toml index 497aae2..977ecd5 100644 --- a/app/pyproject.toml +++ b/app/pyproject.toml @@ -6,7 +6,9 @@ packages = [{ include = "src" }] authors = ["Nava Engineering "] [tool.poetry.dependencies] -python = "^3.12" +# See /docs/app/README.md#Upgrading Python +# for details on upgrading your Python version +python = "~3.12" SQLAlchemy = {version = "^2.0.21", extras = ["mypy"]} alembic = "^1.12.0" python-dotenv = "^1.0.0" diff --git a/docs/app/README.md b/docs/app/README.md index 52bd454..05a80ff 100644 --- a/docs/app/README.md +++ b/docs/app/README.md @@ -152,3 +152,30 @@ The API can be run in debug mode that allows for remote attach debugging (curren ] } ``` + +## Upgrading Python +Python does [yearly releases](https://devguide.python.org/versions/) for their minor versions (eg. 3.12 -> 3.13). They do not +use semvar versioning, and their [minor releases](https://devguide.python.org/developer-workflow/development-cycle/#devcycle) contain +breaking changes. + +Pin to a specific minor version of python just in case anything would break when the yearly release does occur. +Only pin the minor versions of Python (eg. 3.12), and not the patch versions (eg. 3.12.1) as those contain bug and security fixes. + +Along with any version upgrades, remember to: +- Test the system functionality before deploying to production +- Review the [changelog](https://docs.python.org/3/whatsnew/changelog.html) +for any breaking changes of features you may use + +### Upgrade Steps +To upgrade the Python version, make changes in the following places: +1. Local Python version (see more about managing local Python versions in [getting started](/docs/app/getting-started.md)) +2. [Dockerfile](/app/Dockerfile) + search for the line `FROM python:3.12-slim as base` - supported versions can be found on [Dockerhub](https://hub.docker.com/_/python) +3. [pyproject.toml](/app/pyproject.toml) + search for the line + ```toml + [tool.poetry.dependencies] + python = "~3.12" + ``` + Then run `poetry lock --no-update` to update the [poetry.lock](/app/poetry.lock) file. +4. [.python-version](/app/.python-version) which is used by tools like pyenv