Skip to content

Commit 4aad6c2

Browse files
authored
Support python 3.12 (#199)
* Update to python 3.12 * Code style and typing fixes * Disable Pydantic mypy plugin --------- Signed-off-by: Federico Busetti <[email protected]>
1 parent a27dfc8 commit 4aad6c2

30 files changed

+1149
-1096
lines changed

.github/workflows/github-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- name: Checkout
2828
uses: actions/checkout@v4
2929

30-
- name: Set up Python 3.11
30+
- name: Set up Python 3.12
3131
uses: actions/setup-python@v5
3232
with:
33-
python-version: "3.11"
33+
python-version: "3.12"
3434

3535
- name: Install dependencies
3636
run: |

.github/workflows/python-code-style.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up Python 3.11
20+
- name: Set up Python 3.12
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.12"
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip

.github/workflows/python-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up Python 3.11
20+
- name: Set up Python 3.12
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.12"
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip

.github/workflows/python-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up Python 3.11
20+
- name: Set up Python 3.12
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.12"
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
test:
1616
strategy:
1717
matrix:
18-
version: ["3.9", "3.10", "3.11"]
18+
version: ["3.9", "3.10", "3.11", "3.12"]
1919
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:

.github/workflows/python-typing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set up Python 3.11
20+
- name: Set up Python 3.12
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.11"
23+
python-version: "3.12"
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip

.idea/bootstrap-python-fastapi.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG PYTHON_VERSION=3.11
2-
FROM python:$PYTHON_VERSION-slim as base
1+
ARG PYTHON_VERSION=3.12
2+
FROM python:$PYTHON_VERSION-slim AS base
33
ARG UID=2000
44
ARG GID=2000
55
RUN addgroup --gid $GID nonroot && \
@@ -26,7 +26,7 @@ RUN pip install --no-cache-dir -U poetry
2626
# for binaries installed in virtual environments
2727
ENTRYPOINT ["poetry", "run"]
2828

29-
FROM base as base_builder
29+
FROM base AS base_builder
3030
# Install build system requirements (gcc, library headers, etc.)
3131
# for compiled Python requirements like psycopg2
3232
RUN apt-get update \
@@ -44,23 +44,23 @@ COPY --chown=nonroot:nonroot poetry.lock .
4444
COPY --chown=nonroot:nonroot Makefile .
4545

4646
# Test image, contains all files and dependencies
47-
FROM base_builder as dev
47+
FROM base_builder AS dev
4848
COPY --chown=nonroot:nonroot . .
4949
RUN make dev-dependencies
5050
# Note that opentelemetry doesn't play well together with uvicorn reloader
5151
# when signals are propagated, we disable it in dev image default CMD
5252
CMD ["uvicorn", "http_app:create_app", "--host", "0.0.0.0", "--port", "8000", "--factory", "--reload"]
5353

5454
# Installs requirements to run production celery application
55-
FROM base_builder as celery_builder
55+
FROM base_builder AS celery_builder
5656
RUN poetry install --no-root
5757

5858
# Installs requirements to run production http application
59-
FROM base_builder as http_builder
59+
FROM base_builder AS http_builder
6060
RUN poetry install --no-root --with http
6161

6262
# Copy the shared python packages
63-
FROM base as base_app
63+
FROM base AS base_app
6464
USER nonroot
6565
RUN poetry config virtualenvs.path /poetryvenvs
6666
COPY --chown=nonroot:nonroot pyproject.toml .
@@ -73,16 +73,15 @@ COPY --chown=nonroot:nonroot src/alembic.ini .
7373
COPY --chown=nonroot:nonroot Makefile .
7474

7575
# Copy the http python package and requirements from relevant builder
76-
FROM base_app as http_app
76+
FROM base_app AS http_app
7777
COPY --from=http_builder /poetryvenvs /poetryvenvs
7878
COPY --chown=nonroot:nonroot src/http_app ./http_app
7979
# Run CMD using array syntax, so it's uses `exec` and runs as PID1
8080
CMD ["opentelemetry-instrument", "uvicorn", "http_app:create_app", "--host", "0.0.0.0", "--port", "8000", "--factory"]
8181

8282
# Copy the celery python package and requirements from relevant builder
83-
FROM base_app as celery_app
83+
FROM base_app AS celery_app
8484
COPY --from=celery_builder /poetryvenvs /poetryvenvs
8585
COPY --chown=nonroot:nonroot src/celery_worker ./celery_worker
86-
RUN ls
8786
# Run CMD using array syntax, so it's uses `exec` and runs as PID1
8887
CMD ["opentelemetry-instrument", "celery", "-A", "celery_worker:app", "worker", "-l", "INFO"]

0 commit comments

Comments
 (0)