Skip to content

Commit

Permalink
Python 3.11 (#3579)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno authored Nov 5, 2023
1 parent 162bf0e commit 99432b3
Show file tree
Hide file tree
Showing 17 changed files with 562 additions and 751 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pycon-backend-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9.15"
python-version: "3.11.6"
- run: pip install poetry

- name: Cache Poetry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pycon-backend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9.15"
python-version: "3.11.6"
- run: pip install poetry==1.4.2

- name: Cache Poetry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9.15"
python-version: "3.11.6"
- run: pip install poetry
if: steps.changed.outputs.changed.${{ matrix.service.name }} == 'true'
- name: Set Poetry config
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.python.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG FUNCTION_DIR="/home/app/"

FROM python:3.9
FROM python:3.11

RUN apt update -y && apt install -y ffmpeg libsm6 libxext6

Expand Down
1 change: 1 addition & 0 deletions backend/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.11.6
84 changes: 42 additions & 42 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
ARG FUNCTION_DIR="/home/app/"

FROM python:3.9-slim as build-stage
FROM python:3.11-slim as build-stage

ARG FUNCTION_DIR

RUN mkdir -p ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}

RUN apt-get update -y && apt-get install -y \
gcc libpq-dev git \
# Pillow
libtiff5-dev libjpeg62 libopenjp2-7-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
libharfbuzz-dev libfribidi-dev libxcb1-dev libldap2-dev libldap-2.5-0 \
ffmpeg libsm6 libxext6 libglib2.0-0
gcc libpq-dev git \
# Pillow
libtiff5-dev libjpeg62 libopenjp2-7-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
libharfbuzz-dev libfribidi-dev libxcb1-dev libldap2-dev libldap-2.5-0 \
ffmpeg libsm6 libxext6 libglib2.0-0

ENV LIBRARY_PATH=/lib:/usr/lib

RUN pip3 install poetry==1.3.2

RUN tar -czvf /libs.tar.gz /usr/lib/x86_64-linux-gnu/libpq* \
/usr/lib/x86_64-linux-gnu/libpq* \
/usr/lib/x86_64-linux-gnu/libldap_r* \
/usr/lib/x86_64-linux-gnu/libldap* \
/usr/lib/x86_64-linux-gnu/liblber* \
/usr/lib/x86_64-linux-gnu/libsasl* \
/usr/lib/x86_64-linux-gnu/libxml2* \
/usr/lib/x86_64-linux-gnu/libgcrypt* \
/usr/lib/x86_64-linux-gnu/libstdc++* \
/usr/lib/x86_64-linux-gnu/libjpeg* \
/usr/lib/x86_64-linux-gnu/libopenjp2* \
/usr/lib/x86_64-linux-gnu/libdeflate* \
/usr/lib/x86_64-linux-gnu/libjbig* \
/usr/lib/x86_64-linux-gnu/liblcms2* \
/usr/lib/x86_64-linux-gnu/libwebp* \
/usr/lib/x86_64-linux-gnu/libtiff* \
/usr/lib/x86_64-linux-gnu/libGL* \
/usr/lib/x86_64-linux-gnu/libgthread* \
/usr/lib/x86_64-linux-gnu/libglib-* \
/usr/lib/x86_64-linux-gnu/libX11* \
/usr/lib/x86_64-linux-gnu/libxcb* \
/usr/lib/x86_64-linux-gnu/libXau* \
/usr/lib/x86_64-linux-gnu/libXdmcp* \
/usr/lib/x86_64-linux-gnu/libXext* \
/usr/lib/x86_64-linux-gnu/libbsd*
/usr/lib/x86_64-linux-gnu/libpq* \
/usr/lib/x86_64-linux-gnu/libldap_r* \
/usr/lib/x86_64-linux-gnu/libldap* \
/usr/lib/x86_64-linux-gnu/liblber* \
/usr/lib/x86_64-linux-gnu/libsasl* \
/usr/lib/x86_64-linux-gnu/libxml2* \
/usr/lib/x86_64-linux-gnu/libgcrypt* \
/usr/lib/x86_64-linux-gnu/libstdc++* \
/usr/lib/x86_64-linux-gnu/libjpeg* \
/usr/lib/x86_64-linux-gnu/libopenjp2* \
/usr/lib/x86_64-linux-gnu/libdeflate* \
/usr/lib/x86_64-linux-gnu/libjbig* \
/usr/lib/x86_64-linux-gnu/liblcms2* \
/usr/lib/x86_64-linux-gnu/libwebp* \
/usr/lib/x86_64-linux-gnu/libtiff* \
/usr/lib/x86_64-linux-gnu/libGL* \
/usr/lib/x86_64-linux-gnu/libgthread* \
/usr/lib/x86_64-linux-gnu/libglib-* \
/usr/lib/x86_64-linux-gnu/libX11* \
/usr/lib/x86_64-linux-gnu/libxcb* \
/usr/lib/x86_64-linux-gnu/libXau* \
/usr/lib/x86_64-linux-gnu/libXdmcp* \
/usr/lib/x86_64-linux-gnu/libXext* \
/usr/lib/x86_64-linux-gnu/libbsd*

COPY poetry.lock ${FUNCTION_DIR}
COPY pyproject.toml ${FUNCTION_DIR}

RUN poetry config virtualenvs.in-project true
RUN poetry install --no-dev -E lambda

FROM python:3.9-slim
FROM python:3.11-slim

ARG FUNCTION_DIR

Expand All @@ -70,16 +70,16 @@ COPY . ${FUNCTION_DIR}
ENV DJANGO_SETTINGS_MODULE=pycon.settings.prod

RUN USERS_SERVICE=empty \
ASSOCIATION_BACKEND_SERVICE=empty \
SERVICE_TO_SERVICE_SECRET=empty \
AWS_MEDIA_BUCKET=example \
AWS_REGION_NAME=eu-central-1 \
SECRET_KEY=DEMO \
PASTAPORTO_SECRET=demo \
STRIPE_SECRET_API_KEY=demo \
STRIPE_SUBSCRIPTION_PRICE_ID=demo \
STRIPE_WEBHOOK_SIGNATURE_SECRET=demo \
${FUNCTION_DIR}/.venv/bin/python manage.py collectstatic --noinput
ASSOCIATION_BACKEND_SERVICE=empty \
SERVICE_TO_SERVICE_SECRET=empty \
AWS_MEDIA_BUCKET=example \
AWS_REGION_NAME=eu-central-1 \
SECRET_KEY=DEMO \
PASTAPORTO_SECRET=demo \
STRIPE_SECRET_API_KEY=demo \
STRIPE_SUBSCRIPTION_PRICE_ID=demo \
STRIPE_WEBHOOK_SIGNATURE_SECRET=demo \
${FUNCTION_DIR}/.venv/bin/python manage.py collectstatic --noinput

ENTRYPOINT ["/home/app/.venv/bin/python", "-m", "awslambdaric"]
CMD [ "wsgi_handler.handler" ]
5 changes: 2 additions & 3 deletions backend/association_membership/handlers/pretix/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Literal

import httpx
import requests

from django.conf import settings

Expand All @@ -24,8 +24,7 @@ def _request(
if qs:
url = f"{url}?" + "&".join([f"{key}={value}" for key, value in qs.items()])

with httpx.Client(headers=headers) as client:
response = getattr(client, method)(url)
response = getattr(requests, method)(url, headers=headers)

response.raise_for_status()
return response
Expand Down
Loading

1 comment on commit 99432b3

@vercel
Copy link

@vercel vercel bot commented on 99432b3 Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pycon – ./frontend/

2023.pycon.it
pycon-git-main-python-italia.vercel.app
pycon-python-italia.vercel.app
pycon.it
www.pycon.it

Please sign in to comment.