Skip to content

Commit c4670ee

Browse files
committed
Restructuring upgrade guide
1 parent e1bf104 commit c4670ee

File tree

1 file changed

+22
-52
lines changed

1 file changed

+22
-52
lines changed

docs/app/README.md

Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -153,59 +153,29 @@ The API can be run in debug mode that allows for remote attach debugging (curren
153153
}
154154
```
155155

156-
# Upgrading Python
156+
## Upgrading Python
157157
Python does [yearly releases](https://devguide.python.org/versions/) for their minor versions (eg. 3.12 -> 3.13). They do not
158158
use semvar versioning, and their [minor releases](https://devguide.python.org/developer-workflow/development-cycle/#devcycle) contain
159159
breaking changes.
160160

161-
We have this environment configured to use a specific minor version of python just in case anything would break when the yearly release does occur.
162-
163-
We recommend as a starting point, 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.
164-
However, your project may have dependencies, or tools that rely on very specific patch versions of Python, so adjust your approach as necessary.
165-
166-
Along with any version upgrades, you should follow all best practices for upgrading software and test the functionality
167-
of your system before deploying to production. It is also recommended to review the [changelog](https://docs.python.org/3/whatsnew/changelog.html)
168-
for any breaking changes of features you may use.
169-
170-
## Local Development
171-
If you run any of the python code outside of the Docker container, first upgrade your version
172-
of Python locally. The exact way you upgrade will depend on how you originally installed Python,
173-
but one strongly recommended approach is to use [pyenv](https://github.com/pyenv/pyenv) which allows
174-
you to install and swap between different python versions locally.
175-
176-
If you run commands with Poetry, you'll also need to [configure](https://python-poetry.org/docs/managing-environments/#switching-between-environments)
177-
it to use the approach python version.
178-
179-
## Dockerfile
180-
The dockerfile that our API is built from specifies the Python version as the first step.
181-
To upgrade this, simply change the version to the version you would like to use.
182-
183-
For example, to upgrade from 3.12 to 3.13, change the following line:
184-
```dockerfile
185-
FROM python:3.12-slim AS base
186-
```
187-
to
188-
```dockerfile
189-
FROM python:3.13-slim AS base
190-
```
191-
192-
## Poetry
193-
Adjust the pyproject.toml file line that specifies the version of Python used
194-
to your new version. For example, to upgrade from 3.12 to 3.13, change it from:
195-
196-
```toml
197-
[tool.poetry.dependencies]
198-
python = "~3.12"
199-
```
200-
201-
to
202-
```toml
203-
[tool.poetry.dependencies]
204-
python = "~3.13"
205-
```
206-
207-
You will then need to run `poetry lock --no-update` to make the lock file reflect this change.
208-
209-
## Misc
210-
Some tools, include pyenv, reference the [.python-version](/app/.python-version) file in order to determine which
211-
version of python should be used. Update this to the approach version as well.
161+
Pin to a specific minor version of python just in case anything would break when the yearly release does occur.
162+
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.
163+
164+
Along with any version upgrades, remember to:
165+
- Test the system functionality before deploying to production
166+
- Review the [changelog](https://docs.python.org/3/whatsnew/changelog.html)
167+
for any breaking changes of features you may use
168+
169+
### Upgrade Steps
170+
To upgrade the Python version, make changes in the following places:
171+
1. Local Python version (see more about managing local Python versions in [getting started](/docs/app/getting-started.md))
172+
2. [Dockerfile](/app/Dockerfile)
173+
search for the line `FROM python:3.12-slim as base` - supported versions can be found on [Dockerhub](https://hub.docker.com/_/python)
174+
3. [pyproject.toml](/app/pyproject.toml)
175+
search for the line
176+
```toml
177+
[tool.poetry.dependencies]
178+
python = "~3.12"
179+
```
180+
Then run `poetry lock --no-update` to update the [poetry.lock](/app/poetry.lock) file.
181+
4. [.python-version](/app/.python-version) which is used by tools like pyenv

0 commit comments

Comments
 (0)