Skip to content

Commit b020163

Browse files
authored
Merge pull request #1262 from alphagov/upgrade_to_python313
Upgrade to python313
2 parents 1560718 + bce4d82 commit b020163

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 101.3.0
4+
5+
* Upgrade Python version to 3.13
6+
* Adjust get_remote_version() to compensate for changes in locals() in Python 3.13
7+
38
## 101.2.1
49

510
- Remove `clients.redis.rate_limit_cache_key` (no longer used)

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-bookworm AS test
1+
FROM python:3.13-bookworm AS test
22
WORKDIR /home/vcap/app
33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \

notifications_utils/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# - `make version-minor` for new features
66
# - `make version-patch` for bug fixes
77

8-
__version__ = "101.2.1" # 67bdb2db1d590d079d507ea9662cf6fb
8+
__version__ = "101.3.0" # c6298a7a74b9758048d755d97673f55a

notifications_utils/version_tools/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ def upgrade_version():
5050

5151

5252
def get_remote_version():
53-
exec(get_file_contents_from_github("main", "notifications_utils/version.py"))
54-
return locals()["__version__"]
53+
# The functionality of locals() has been optimised starting in Python 3.12 and further
54+
# in Python 3.13 due to PEP 667 https://github.com/python/cpython/issues/118888
55+
# locals is no longer has insight into a functions state. We now have to explicitly define a local scope dict.
56+
local_scope = {}
57+
version_data = get_file_contents_from_github("main", "notifications_utils/version.py")
58+
exec(version_data, {}, local_scope)
59+
return local_scope["__version__"]
5560

5661

5762
def get_app_version():

requirements_for_test.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# uv pip compile requirements_for_test.in pyproject.toml --output-file requirements_for_test.txt
33
amqp==5.2.0
44
# via kombu
5-
async-timeout==5.0.1
6-
# via redis
75
awscrt==0.22.0
86
# via botocore
97
beautifulsoup4==4.12.3

0 commit comments

Comments
 (0)