Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _templates_suffix: ""

_tasks:
- python tasks.py
- bash scripts/update-python-version.sh

_subdirectory: template

Expand Down
2 changes: 1 addition & 1 deletion template/.github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.14"
- name: Run backend tests
run: CI=true make backend-test
env:
Expand Down
2 changes: 1 addition & 1 deletion template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pipdeptree: ## Show the dependencies of installed packages as a tree structure
$(KUBECTL_EXEC_BACKEND) -c "uv pip tree --no-cache"

compile: backend/requirements/base.in backend/requirements/tests.in ## compile latest requirements to be built into the docker image
@docker run --rm -v $(shell pwd)/backend/requirements:/local python:3.13-slim /bin/bash -c \
@docker run --rm -v $(shell pwd)/backend/requirements:/local python:3.14-slim /bin/bash -c \
"apt-get update; apt-get install -y libpq-dev; \
pip install uv; \
touch /local/base.txt; touch /local/production.txt; touch /local/tests.txt; touch /local/local.txt; \
Expand Down
4 changes: 2 additions & 2 deletions template/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build all of the dependencies then we will build the actual application image
FROM python:3.13-slim AS build
FROM python:3.14-slim AS build

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down Expand Up @@ -54,7 +54,7 @@ RUN set -x \
-r /tmp/requirements/tests.txt; fi

# Now we can build the application image
FROM python:3.13-slim
FROM python:3.14-slim

ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH="/app"
Expand Down
2 changes: 1 addition & 1 deletion template/bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: python:3.12
image: python:3.14

definitions:
services:
Expand Down
2 changes: 1 addition & 1 deletion template/k8s/base/app.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data:
# todo: see if PYDEVD_USE_* can be removed later, I was getting this error
# with pydevd-pycharm==243.26053.29:
# cannot import name 'trace_dispatch' from '_pydevd_bundle.pydevd_trace_dispatch'
# (/app/lib/python3.12/site-packages/_pydevd_bundle/pydevd_trace_dispatch.py)
# (/app/lib/python3.14/site-packages/_pydevd_bundle/pydevd_trace_dispatch.py)
# Also probably need to add cython to local.in in that case.
PYDEVD_USE_CYTHON: "NO"
PYDEVD_USE_FRAME_EVAL: "NO"
Expand Down
29 changes: 29 additions & 0 deletions template/scripts/update-python-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

# Kept as a single script so the Docker Hub API is called once and the resolved
# version is shared across all file updates without needing a temp file.

tags=$(curl -fsSL "https://registry.hub.docker.com/v2/repositories/library/python/tags?page_size=100")

minor=$(echo "$tags" | jq -r '
[.results[].name | select(test("^[0-9]+\\.[0-9]+-slim$")) | rtrimstr("-slim")]
| map(split(".") | map(tonumber))
| max_by(.[0] * 1000 + .[1])
| join(".")
')

full=$(echo "$tags" | jq -r --arg minor "$minor" '
[.results[].name | select(test("^" + $minor + "\\.[0-9]+-slim$")) | rtrimstr("-slim")]
| map(split(".") | map(tonumber))
| if length > 0 then max_by(.[2]) | join(".") else $minor end
')

echo "Updating Python version to ${minor} (Docker: ${full})"

update() { if [ -f "$1" ]; then sed -i "${@:2}" "$1"; fi; }

update backend/Dockerfile "s|python:[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?-slim|python:${full}-slim|g"
update Makefile "s|python:[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?-slim|python:${full}-slim|g" # not in django-template
update bitbucket-pipelines.yml "s|image: python:[0-9]\+\.[0-9]\+|image: python:${minor}|g" # not in django-template
update .github/workflows/main.yaml "s|python-version: \"[0-9]\+\.[0-9]\+\"|python-version: \"${minor}\"|g" # not in django-template
Loading