Skip to content

Commit

Permalink
[u] Update to Python 3.12.x (#5736)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed Dec 4, 2024
1 parent 5160a58 commit 3e30c8c
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hello: check_python
virtualenv: check_env
@if test -s "$$VIRTUAL_ENV"; then echo -e "\nRun 'deactivate' first\n"; false; fi
if test -e .venv; then rm -rf .venv/; fi
python3.11 -m venv .venv
python3.12 -m venv .venv
@echo -e "\nRun 'source .venv/bin/activate' now!\n"

.PHONY: envhook
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ found in [`AzulTestCase`](test/azul_test_case.py) and commit the modifications.
## Setting up the Azul build prerequisites on macOS 12 (Monterey)
The steps below are examplary for Python 3.11.6. Replace `3.11.6` with the value
The steps below are examplary for Python 3.12.7. Replace `3.12.7` with the value
of `azul_python_version` in [environment.py](environment.py).
Make `bash` the default shell. Google it.
Expand All @@ -1048,10 +1048,10 @@ brew install zlib pyenv
Install python
```
pyenv install 3.11.6
pyenv install 3.12.7
```
Set `PYENV_VERSION` to `3.11.6` in `environment.local.py` at the project root.
Set `PYENV_VERSION` to `3.12.7` in `environment.local.py` at the project root.
Do not set `SYSTEM_VERSION_COMPAT`. For a more maintainable configuration use
`os.environ['azul_python_version']` as the value and `import os` at the top.
Expand Down Expand Up @@ -2319,10 +2319,10 @@ If you add a dependency on a package with native code, you need to build the
wheel manually:

```
(.venv) ~/workspace/hca/azul$ docker run -it -v ${project_root}/:/root/azul python:3.11.6-bullseye bash
(.venv) ~/workspace/hca/azul$ docker run -it -v ${project_root}/:/root/azul python:3.12.7-slim-bookworm bash
root@97804cb60d95:/# pip --version
pip 22.0.4 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
pip 24.2 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)
root@97804cb60d95:/# cd /root/azul/lambdas/.wheels
Expand Down
7 changes: 7 additions & 0 deletions UPGRADING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ branch that does not have the listed changes, the steps would need to be
reverted. This is all fairly informal and loosely defined. Hopefully we won't
have too many entries in this file.

#5736 Update to Python 3.12.x
=============================

Update Python on your developer machines to version 3.12.7. In your working
copy, run ``make virtualenv`` and ``make requirements envhook``.


#6531 Eliminate RepositoryPlugin.list_partitions
================================================

Expand Down
2 changes: 1 addition & 1 deletion deployments/dev/.example.environment.local.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def env() -> Mapping[str, Optional[str]]:
other environment variables in the form `{FOO}` where FOO is the name of an
environment variable. See
https://docs.python.org/3.11/library/string.html#format-string-syntax
https://docs.python.org/3.12/library/string.html#format-string-syntax
for the concrete syntax. These references will be resolved *after* the
overall environment has been compiled by merging all relevant
Expand Down
2 changes: 1 addition & 1 deletion deployments/dev/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def env() -> Mapping[str, Optional[str]]:
other environment variables in the form `{FOO}` where FOO is the name of an
environment variable. See
https://docs.python.org/3.11/library/string.html#format-string-syntax
https://docs.python.org/3.12/library/string.html#format-string-syntax
for the concrete syntax. These references will be resolved *after* the
overall environment has been compiled by merging all relevant
Expand Down
14 changes: 7 additions & 7 deletions docker_images.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
}
}
},
"docker.io/library/python:3.11.10-slim-bullseye": {
"digest": "sha256:d910a25afa706e0b2da4b59990fb59c0495eeab597b5cd777bbdcda8b6530b7e",
"mirror_digest": "sha256:adf1510bd25dc1c8df48eda096007f997155a7d536e4bb7e01a9cc5dc6206f63",
"docker.io/library/python:3.12.7-slim-bookworm": {
"digest": "sha256:2a6386ad2db20e7f55073f69a98d6da2cf9f168e05e7487d2670baeb9b7601c5",
"mirror_digest": "sha256:e0a42aac29c848373dadeb69551ffa6ab97a9aceba49b415bafc8c117e9dd074",
"parts": {
"linux/amd64": {
"digest": "sha256:8e9c9384f38f32f87a42f79f4253fd47c92818ddb92b491e147d900f610ec8ba",
"id": "sha256:998f066b8032171d3f2e3cff42d7cbb3199aed0da52251449b40038fd7d8753a",
"digest": "sha256:c013e32e74b0ed13ac59533a446bcfcc962a877ea534ef305d455624dd71b1ac",
"id": "sha256:668757ec60efb72ddf3c03bc8d452cc79173fcc6a04c5b5d5f8b470ff1370973",
"platform": "linux/amd64"
},
"linux/arm64": {
"digest": "sha256:9e02523f5447f2df5ca5ce3c8dffadf59107f40e0087e4a083a38899ed412b0c",
"id": "sha256:94f4369772e8b5b424f49363574d3f8efaddf03f16745e1037aca9f4445a3843",
"digest": "sha256:d21d7b3b7dbd985e7e71b42435d5218c2a4b211e4fca66f3a9b66f2c7624fcec",
"id": "sha256:e359a8be29f6b9052628a435cb590f905d643431f96f7c1decce226155cc6d3b",
"platform": "linux/arm64"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/licenses/python.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://docs.python.org/3.11/license.html
https://docs.python.org/3.12/license.html

The MIT License

Expand Down
4 changes: 2 additions & 2 deletions environment.boot
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
azul_python_version=3.11.10
azul_python_image=docker.io/library/python@sha256:adf1510bd25dc1c8df48eda096007f997155a7d536e4bb7e01a9cc5dc6206f63
azul_python_version=3.12.7
azul_python_image=docker.io/library/python@sha256:e0a42aac29c848373dadeb69551ffa6ab97a9aceba49b415bafc8c117e9dd074
azul_docker_version=27.3.1
azul_terraform_version=1.9.8
6 changes: 3 additions & 3 deletions environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def env() -> Mapping[str, Optional[str]]:
other environment variables in the form `{FOO}` where FOO is the name of an
environment variable. See
https://docs.python.org/3.11/library/string.html#format-string-syntax
https://docs.python.org/3.12/library/string.html#format-string-syntax
for the concrete syntax. These references will be resolved *after* the
overall environment has been compiled by merging all relevant
Expand Down Expand Up @@ -248,7 +248,7 @@ def env() -> Mapping[str, Optional[str]]:
# and committing the resulting changes. It also requires redeploying the
# `shared` component.
#
'azul_python_version': '3.11.10',
'azul_python_version': '3.12.7',

# The version of Terraform used throughout the system.
#
Expand Down Expand Up @@ -279,7 +279,7 @@ def env() -> Mapping[str, Optional[str]]:
# See `azul_python_version` above about what actions are required
# after modifying this entry.
'python': {
'ref': 'docker.io/library/python:{azul_python_version}-slim-bullseye',
'ref': 'docker.io/library/python:{azul_python_version}-slim-bookworm',
'url': 'https://hub.docker.com/_/python',
},
'pycharm': {
Expand Down
2 changes: 1 addition & 1 deletion scripts/convert_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def env() -> Mapping[str, Optional[str]]:
other environment variables in the form `{FOO}` where FOO is the name of an
environment variable. See
https://docs.python.org/3.11/library/string.html#format-string-syntax
https://docs.python.org/3.12/library/string.html#format-string-syntax
for the concrete syntax. These references will be resolved *after* the
overall environment has been compiled by merging all relevant
Expand Down
2 changes: 1 addition & 1 deletion scripts/export_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def env(self) -> DraftEnvironment:
references to other environment variables in the form `{FOO}` where
FOO is the name of an environment variable. See
https://docs.python.org/3.11/library/string.html#format-string-syntax
https://docs.python.org/3.12/library/string.html#format-string-syntax
for the concrete syntax. Any references will be resolved after the
environment has been compiled by merging all environment.py files.
Expand Down
2 changes: 1 addition & 1 deletion src/azul/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def configure_app_logging(app: AzulChaliceApp, *loggers):
# module can be found on GitHub, in the repository linked below. Note
# that one must extract the image tarball to get to the module.
#
# https://github.com/aws/aws-lambda-base-images/tree/python3.11
# https://github.com/aws/aws-lambda-base-images/tree/python3.12
#
handler = one(root_logger.handlers)
root_formatter = logging.Formatter(lambda_log_format, lambda_log_date_format)
Expand Down
8 changes: 4 additions & 4 deletions test/test_log_forwarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def test_s3(self):
'85',
'52',
dq('-'),
dq('Boto3/1.24.94 Python/3.11.5 Linux/4.14.255-301-238.520.amzn2.x86_64',
'exec-env/AWS_Lambda_python3.11 aws-chalice/1.30.0 Botocore/1.27.94'),
dq('Boto3/1.24.94 Python/3.12.7 Linux/4.14.255-301-238.520.amzn2.x86_64',
'exec-env/AWS_Lambda_python3.12 aws-chalice/1.30.0 Botocore/1.27.94'),
'-',
'jcmyLMRqqJ7dT4ovtY21rtgwmuTC3qs24vgAtLAkcad9sRV92zC90gf2zGvCkxxsLSaKm48AMjo=',
'SigV4',
Expand Down Expand Up @@ -193,8 +193,8 @@ def test_s3(self):
'tls_version': 'TLSv1.2',
'total_time': '85',
'turn_around_time': '52',
'user_agent': 'Boto3/1.24.94 Python/3.11.5 Linux/4.14.255-301-238.520.amzn2.x86_64 '
'exec-env/AWS_Lambda_python3.11 aws-chalice/1.30.0 Botocore/1.27.94',
'user_agent': 'Boto3/1.24.94 Python/3.12.7 Linux/4.14.255-301-238.520.amzn2.x86_64 '
'exec-env/AWS_Lambda_python3.12 aws-chalice/1.30.0 Botocore/1.27.94',
'version_id': '-',
}]
self._test(self.controller.forward_s3_access_logs, input, expected_output)
Expand Down

0 comments on commit 3e30c8c

Please sign in to comment.