Skip to content

Commit 8d4ee58

Browse files
authored
Upgrade python to version 3.12 (#3067)
* Upgrade project to python version 3.12 Signed-off-by: jamshale <[email protected]> * Fix a unit test Signed-off-by: jamshale <[email protected]> * Remove old loop argument from wait_for in demo Signed-off-by: jamshale <[email protected]> * Add small sleep for holder deleted credential tests Signed-off-by: jamshale <[email protected]> * Update more dockerfiles and docs to python 3.12 Signed-off-by: jamshale <[email protected]> * Update python in RTD's Signed-off-by: jamshale <[email protected]> * Update poetry.lock after rebase Signed-off-by: jamshale <[email protected]> * Update poetry.lock after rebase Signed-off-by: jamshale <[email protected]> --------- Signed-off-by: jamshale <[email protected]>
1 parent 314062b commit 8d4ee58

25 files changed

+42
-106
lines changed

Diff for: .devcontainer/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/python-3/.devcontainer/base.Dockerfile
2-
ARG VARIANT="3.9"
3-
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
2+
ARG VARIANT="3.12"
3+
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
44

55
ARG POETRY_VERSION="1.4"
66
ENV POETRY_HOME="/opt/poetry" \

Diff for: .devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dockerfile": "Dockerfile",
77
"context": "..",
88
"args": {
9-
"VARIANT": "3.9-bullseye",
9+
"VARIANT": "3.12-bullseye",
1010
"POETRY_VERSION": "1.7.1"
1111
}
1212
},

Diff for: .github/workflows/format.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-python@v5
1515
with:
16-
python-version: "3.9"
16+
python-version: "3.12"
1717
- name: Ruff Format and Lint Check
1818
uses: chartboost/ruff-action@v1

Diff for: .github/workflows/nigthly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: ["ubuntu-latest"]
15-
python-version: ["3.9", "3.10"]
15+
python-version: ["3.12"]
1616
if: github.repository == 'hyperledger/aries-cloudagent-python' || github.event_name == 'workflow_dispatch'
1717
steps:
1818
- name: checkout

Diff for: .github/workflows/pr-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
- name: Tests
1717
uses: ./.github/actions/run-unit-tests
1818
with:
19-
python-version: "3.9"
19+
python-version: "3.12"
2020
os: "ubuntu-latest"
2121
is_pr: "true"

Diff for: .github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
python-version: ['3.9']
45+
python-version: ['3.12']
4646

4747
name: Publish ACA-Py Image
4848
runs-on: ubuntu-latest

Diff for: .github/workflows/sonar-merge-main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Tests
1616
uses: ./.github/actions/run-unit-tests
1717
with:
18-
python-version: "3.9"
18+
python-version: "3.12"
1919
os: "ubuntu-latest"
2020
is_pr: "false"
2121
- name: Adjust Test Coverage Source

Diff for: .readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: "ubuntu-20.04"
55
tools:
6-
python: "3.9"
6+
python: "3.12"
77

88
sphinx:
99
builder: dirhtml

Diff for: aries_cloudagent/core/tests/test_plugin_registry.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
from unittest import IsolatedAsyncioTestCase
2+
from unittest.mock import call
3+
14
import pytest
25

36
from aries_cloudagent.tests import mock
4-
from unittest import IsolatedAsyncioTestCase
5-
from unittest.mock import call
67

78
from ...config.injection_context import InjectionContext
89
from ...utils.classloader import ClassLoader, ModuleLoadError
9-
10+
from ..error import ProtocolDefinitionValidationError
11+
from ..goal_code_registry import GoalCodeRegistry
1012
from ..plugin_registry import PluginRegistry
1113
from ..protocol_registry import ProtocolRegistry
12-
from ..goal_code_registry import GoalCodeRegistry
13-
14-
from ..error import ProtocolDefinitionValidationError
1514

1615

1716
class TestPluginRegistry(IsolatedAsyncioTestCase):
@@ -365,9 +364,13 @@ async def test_validate_version_list_correct(self):
365364
) as load_module:
366365
assert self.registry.validate_version(versions, mod_name) is True
367366

368-
load_module.has_calls(
369-
call(versions[0]["path"], mod_name),
370-
call(versions[1]["path"], mod_name),
367+
load_module.assert_has_calls(
368+
[
369+
call("v1_0", "test_mod"),
370+
call().__bool__(),
371+
call("v2_0", "test_mod"),
372+
call().__bool__(),
373+
]
371374
)
372375

373376
async def test_validate_version_list_extra_attributes_ok(self):

Diff for: demo/features/steps/0453-issue-credential.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def step_impl(context, issuer, credential_data):
9898
context.cred_exchange = cred_exchange
9999

100100
# delete this immediately, hopefully this is committed before the holder "accepts" it
101-
resp = agent_container_DELETE(
101+
agent_container_DELETE(
102102
agent["agent"],
103103
f"/issue-credential-2.0/records/{cred_exchange['cred_ex_id']}",
104104
)

Diff for: demo/playground/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ These configuration files are provided to the ACA-Py start command via the `AGEN
2626

2727
### Dockerfile and start.sh
2828

29-
[`Dockerfile.acapy`](./Dockerfile.acapy) assembles the image to run. Currently based on [Aries Cloudagent Python 0.8.1](ghcr.io/hyperledger/aries-cloudagent-python:py3.9-indy-1.16.0-0.8.1), we need [jq](https://stedolan.github.io/jq/) to setup (or not) the ngrok tunnel and execute the Aca-py start command - see [`start.sh`](./start.sh). You may note that the start command is very sparse, additional configuration is done via environment variables in the [docker compose file](./docker-compose.yml).
29+
[`Dockerfile.acapy`](./Dockerfile.acapy) assembles the image to run. Currently based on [Aries Cloudagent Python 0.21.1](ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1), we need [jq](https://stedolan.github.io/jq/) to setup (or not) the ngrok tunnel and execute the Aca-py start command - see [`start.sh`](./start.sh). You may note that the start command is very sparse, additional configuration is done via environment variables in the [docker compose file](./docker-compose.yml).
3030

3131
### ngrok
3232

Diff for: demo/playground/examples/Dockerfile.test.runner

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9-slim
1+
FROM python:3.12-slim
22
WORKDIR /usr/src/app
33

44
# install poetry

Diff for: demo/playground/examples/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = ""
55
authors = ["Jason Sherman <[email protected]>"]
66

77
[tool.poetry.dependencies]
8-
python = "^3.9"
8+
python = "^3.12"
99
pytest = "^7.4.4"
1010
pytest-asyncio = "^0.23.7"
1111
asynctest = "^0.13.0"

Diff for: demo/runners/agent_container.py

+2
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ async def handle_issue_credential_v2_0(self, message):
274274

275275
elif state == "offer-received":
276276
log_status("#15 After receiving credential offer, send credential request")
277+
# Should wait for a tiny bit for the delete tests
278+
await asyncio.sleep(0.2)
277279
if not message.get("by_format"):
278280
# this should not happen, something hinky when running in IDE...
279281
# this will work if using indy payloads

Diff for: demo/runners/support/agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ async def start_process(self, python_path: str = None, wait: bool = True):
943943
future = loop.run_in_executor(
944944
self.thread_pool_executor, self._process, agent_args, my_env, loop
945945
)
946-
self.proc = await asyncio.wait_for(future, 20, loop=loop)
946+
self.proc = await asyncio.wait_for(future, 20)
947947
if wait:
948948
await asyncio.sleep(1.0)
949949
await self.detect_process()
@@ -970,7 +970,7 @@ async def terminate(self):
970970
loop = asyncio.get_event_loop()
971971
if self.proc:
972972
future = loop.run_in_executor(self.thread_pool_executor, self._terminate)
973-
result = await asyncio.wait_for(future, 10, loop=loop)
973+
await asyncio.wait_for(future, 10)
974974

975975
async def listen_webhooks(self, webhook_port):
976976
self.webhook_port = webhook_port

Diff for: docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG python_version=3.9.18
1+
ARG python_version=3.12
22
FROM python:${python_version}-slim-bullseye AS build
33

44
WORKDIR /src

Diff for: docker/Dockerfile.demo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG from_image=ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.9.0
1+
ARG from_image=ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1
22
FROM ${from_image}
33

44
ENV ENABLE_PTVSD 0

Diff for: docker/Dockerfile.indy

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG python_version=3.9.18
1+
ARG python_version=3.12.4
22
ARG rust_version=1.46
33

44
# This image could be replaced with an "indy" image from another repo,

Diff for: docker/Dockerfile.run

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG python_version=3.9.16
2-
FROM python:3.9-slim-bullseye
1+
ARG python_version=3.12.4
2+
FROM python:3.12-slim-bullseye
33

44
RUN apt-get update -y && \
55
apt-get install -y --no-install-recommends \

Diff for: docker/Dockerfile.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG python_version=3.9.18
1+
ARG python_version=3.12.4
22
FROM python:${python_version}-slim-bullseye
33

44
RUN apt-get update -y && \

Diff for: docs/features/devcontainer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ To open ACA-Py in a devcontainer, we open the *root* of this repository. We can
4444

4545
#### devcontainer.json
4646

47-
When the [.devcontainer/devcontainer.json](https://github.com/hyperledger/aries-cloudagent-python/blob/main/.devcontainer/devcontainer.json) is opened, you will see it building... it is building a Python 3.9 image (bash shell) and loading it with all the ACA-Py requirements. We also load a few Visual Studio settings (for running Pytests and formatting with Ruff).
47+
When the [.devcontainer/devcontainer.json](https://github.com/hyperledger/aries-cloudagent-python/blob/main/.devcontainer/devcontainer.json) is opened, you will see it building... it is building a Python 3.12 image (bash shell) and loading it with all the ACA-Py requirements. We also load a few Visual Studio settings (for running Pytests and formatting with Ruff).
4848

4949
### Poetry
5050

Diff for: docs/readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 2
55
build:
66
os: "ubuntu-20.04"
77
tools:
8-
python: "3.7"
8+
python: "3.12"
99

1010
# Build from the docs/ directory with Sphinx
1111
sphinx:

Diff for: poetry.lock

+3-72
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repository = "https://github.com/hyperledger/aries-cloudagent-python"
1515

1616

1717
[tool.poetry.dependencies]
18-
python = "^3.9"
18+
python = "^3.12"
1919
aiohttp="~3.9.4"
2020
aiohttp-apispec-acapy="~3.0.2"
2121
aiohttp-cors="~0.7.0"

Diff for: sonar-project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sonar.projectKey=hyperledger_aries-cloudagent-python
22
sonar.organization=hyperledger
33
sonar.projectName=aries-cloudagent-python
44

5-
sonar.python.version=3.9
5+
sonar.python.version=3.12

0 commit comments

Comments
 (0)