Skip to content

Commit f8066b0

Browse files
authored
upgrade python to 3.12 (#1850)
## Overview This commit upgrades the data.all framework from Python 3.9 to Python 3.12, modernizing the runtime environment and improving performance, security, and compatibility. ## Key Changes ### 🐍 **Python Runtime Upgrade** - **Core upgrade**: Python 3.9 → Python 3.12 across all environments - **New runtime configuration**: Added `deploy/stacks/runtime_options.py` to centrally manage Python version settings - **Lambda runtime**: Updated to use Python 3.12 runtime for AWS Lambda functions ### 📦 **Dependency Updates** (either because they were incompatible with 3.12 or because they raised known vulnerabilities) - **ariadne**: 0.17.0 → 0.26.2 (GraphQL library upgrade) - **fastapi**: 0.115.5 → 0.116.1 (minor version bump) - **PyYAML**: 6.0 → 6.0.2 (patch update) - **aws-cdk-lib**: 2.177.0 → 2.208.0 (significant CDK upgrade) ### 🐳 **Docker Infrastructure Improvements** - **Replace dev/Dockerfile**: Refactored prod Dockerfiles and compose to use those in our local setup which reduces duplication but also the local environment is close to the prod. - **Simplified base images**: Removed custom Elasticsearch and PostgreSQL Dockerfiles, now using official images - **Health checks**: Added comprehensive health checks for all services in docker-compose - **Service dependencies**: Improved service dependency management with condition-based startup - **Removed wait-for-it.sh**: Eliminated custom wait script in favor of Docker health checks - **Use Configs, Secrets and Watch**: Replace volume mounts with the more modern Configs (bind configs in containers), Secrets (bind secrets in containers) and Watch (monitor for changes and sync them in the container) ### 🏗️ **Container Orchestration Enhancements** - **PostgreSQL**: Switched to official `postgres:16.4` image (match the version used in Aurora) - **Elasticsearch**: Switched to official `docker.elastic.co/elasticsearch/elasticsearch:7.9.3` image - **Service isolation**: Better container naming and networking configuration - **Startup reliability**: Enhanced service startup sequence with proper health monitoring ### 🧹 **Code Cleanup** - **Removed files**: - `backend/docker/dev/wait-for-it.sh` (replaced by health checks) - `compose/elasticsearch/Dockerfile` and config (using official image) - `compose/postgres/Dockerfile` (using official image) Resolve #1842
1 parent c191684 commit f8066b0

35 files changed

Lines changed: 273 additions & 418 deletions

.github/workflows/alembic-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: [ 3.9 ]
19+
python-version: [ 3.12 ]
2020
services:
2121
postgres:
2222
image: postgres
@@ -41,4 +41,4 @@ jobs:
4141
- name: Drop tables
4242
run: make drop-tables
4343
- name: Upgrade tables
44-
run: make upgrade-db
44+
run: make upgrade-db

.github/workflows/ash.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.9]
14+
python-version: [3.12]
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/bandit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
bandit:
1818
strategy:
1919
matrix:
20-
python-version: [3.9]
20+
python-version: [3.12]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4

.github/workflows/cdk-nag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
cdk-nag:
2222
strategy:
2323
matrix:
24-
python-version: [3.9]
24+
python-version: [3.12]
2525
env:
2626
CDK_DEFAULT_REGION: eu-west-1
2727
CDK_DEFAULT_ACCOUNT: 111111111111

.github/workflows/checkov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
DATAALL_REPO_BRANCH: main
2525
strategy:
2626
matrix:
27-
python-version: [3.9]
27+
python-version: [3.12]
2828
services:
2929
postgres:
3030
image: postgres

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: [ 3.9 ]
17+
python-version: [ 3.12 ]
1818
services:
1919
postgres:
2020
image: postgres
@@ -37,4 +37,4 @@ jobs:
3737
python-version: ${{ matrix.python-version }}
3838
cache: 'pip'
3939
- name: coverage
40-
run: make coverage
40+
run: make coverage

.github/workflows/snyk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
security:
1515
strategy:
1616
matrix:
17-
python-version: [3.9]
17+
python-version: [3.12]
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ coverage: upgrade-pip install-backend install-cdkproxy install-tests
7979
--color=yes
8080

8181
deploy-image:
82-
docker build -f backend/docker/prod/${type}/Dockerfile -t ${image-tag}:${image-tag} . && \
82+
docker build ${build-args} -f backend/docker/prod/${type}/Dockerfile -t ${image-tag}:${image-tag} . && \
8383
aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${account}.dkr.ecr.${region}.amazonaws.com && \
8484
docker tag ${image-tag}:${image-tag} ${account}.dkr.ecr.${region}.amazonaws.com/${repo}:${image-tag} && \
8585
docker push ${account}.dkr.ecr.${region}.amazonaws.com/${repo}:${image-tag}

backend/dataall/base/cdkproxy/cdk_cli_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def describe_stack(stack, engine: Engine = None, stackid: str = None):
216216

217217

218218
def cdk_installed():
219-
cmd1 = ['.', '~/.nvm/nvm.sh']
219+
cmd1 = ['bash', '~/.nvm/nvm.sh']
220220
logger.info(f'Running command {" ".join(cmd1)}')
221221
subprocess.run(
222222
cmd1,

backend/dataall/base/cdkproxy/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
aws-cdk-lib==2.177.0
1+
aws-cdk-lib==2.208.0
22
boto3==1.35.26
33
boto3-stubs==1.35.26
44
cdk-nag==2.7.2
5-
fastapi == 0.115.5
6-
PyYAML==6.0
5+
fastapi == 0.116.1
6+
PyYAML==6.0.2
77
requests==2.32.4
88
tabulate==0.8.9
99
uvicorn==0.15.0

0 commit comments

Comments
 (0)