Skip to content

Commit

Permalink
feat!: python 3.12 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq committed Sep 9, 2024
1 parent 5624d7f commit 169da40
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- ubuntu-20.04
python-version:
- 3.8
- 3.12
targets: [ 'quality','main.test','docs' ]

steps:
Expand All @@ -40,7 +40,7 @@ jobs:
&& export TOXENV=django42 && make test.requirements tox.requirements ${{ matrix.targets }}"

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.targets=='main.test'
if: matrix.python-version == '3.12' && matrix.targets=='main.test'
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .github/workflows/mysql8-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-20.04 ]
python-version: [ 3.8 ]
python-version: [ 3.12 ]

steps:
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
with:
branch: ${{ github.event.inputs.branch || 'master' }}
python_version: "3.8"
# optional parameters below; fill in if you'd like github or email notifications
# user_reviewers: ""
# team_reviewers: ""
email_address: "[email protected]"
send_success_notification: true
python_version: 3.12
secrets:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
Expand Down
29 changes: 25 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ FROM ubuntu:focal as base

# System requirements.

# ENV variables for Python 3.12 support
ARG PYTHON_VERSION=3.12
ENV TZ=UTC
ENV TERM=xterm-256color
ENV DEBIAN_FRONTEND=noninteractive

# software-properties-common is needed to setup Python 3.12 env
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-add-repository -y ppa:deadsnakes/ppa

# pkg-config; mysqlclient>=2.2.0 requires pkg-config (https://github.com/PyMySQL/mysqlclient/issues/620)

RUN apt update && \
Expand All @@ -10,14 +21,24 @@ RUN apt update && \
vim \
language-pack-en \
build-essential \
python3.8-dev \
python3-virtualenv \
python3.8-distutils \
libffi-dev \
libsqlite3-dev \
python3-pip \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-distutils \
libmysqlclient-dev \
pkg-config \
libssl-dev && \
rm -rf /var/lib/apt/lists/*

# Set Zoneinfo settings for Python 3.12 support
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# need to use virtualenv pypi package with Python 3.12
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}
RUN pip install virtualenv

# Use UTF-8.
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
Expand All @@ -39,7 +60,7 @@ ENV ANALYTICS_API_CFG "/edx/etc/${ANALYTICS_API_SERVICE_NAME}.yml"
# Working directory will be root of repo.
WORKDIR ${ANALYTICS_API_CODE_DIR}

RUN virtualenv -p python3.8 --always-copy ${ANALYTICS_API_VENV_DIR}
RUN virtualenv -p python${PYTHON_VERSION} --always-copy ${ANALYTICS_API_VENV_DIR}

# Expose canonical Analytics port
EXPOSE 19001
Expand Down
7 changes: 1 addition & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand All @@ -9,10 +9,6 @@ asgiref==3.8.1
# django
# django-cors-headers
# django-countries
backports-zoneinfo==0.2.1
# via
# django
# djangorestframework
boto==2.49.0
# via -r requirements/base.in
boto3==1.35.8
Expand Down Expand Up @@ -234,7 +230,6 @@ tqdm==4.66.5
# via -r requirements/base.in
typing-extensions==4.12.2
# via
# asgiref
# django-countries
# edx-opaque-keys
tzdata==2024.1
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand Down
7 changes: 7 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ pylint-django==2.0.11

# botocore 1.34.144 depends on urllib3<1.27 and >=1.25.4; python_version < "3.10"
urllib3<2.0.0

# path>16.14.0 has removed the deprecated abspath function, which is breaking the docs build
path<16.15.0

# pip==24.2 is breaking with latest pip-tools version
# can be removed once pip-tools with compatibility is out
pip<24.2
7 changes: 1 addition & 6 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand All @@ -9,10 +9,6 @@ asgiref==3.8.1
# django
# django-cors-headers
# django-countries
backports-zoneinfo==0.2.1
# via
# django
# djangorestframework
boto==2.49.0
# via -r requirements/base.in
boto3==1.35.8
Expand Down Expand Up @@ -236,7 +232,6 @@ tqdm==4.66.5
# via -r requirements/base.in
typing-extensions==4.12.2
# via
# asgiref
# django-countries
# edx-opaque-keys
tzdata==2024.1
Expand Down
29 changes: 12 additions & 17 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
#
accessible-pygments==0.0.4
accessible-pygments==0.0.5
# via pydata-sphinx-theme
alabaster==0.7.13
alabaster==1.0.0
# via sphinx
asgiref==3.8.1
# via
Expand All @@ -17,10 +17,6 @@ babel==2.16.0
# via
# pydata-sphinx-theme
# sphinx
backports-zoneinfo==0.2.1
# via
# django
# djangorestframework
beautifulsoup4==4.12.3
# via pydata-sphinx-theme
boto==2.49.0
Expand Down Expand Up @@ -107,7 +103,7 @@ djangorestframework-csv==3.0.2
# edx-enterprise-data
dnspython==2.6.1
# via pymongo
docutils==0.19
docutils==0.21.2
# via
# pydata-sphinx-theme
# sphinx
Expand Down Expand Up @@ -201,7 +197,7 @@ psutil==6.0.0
# via edx-django-utils
pycparser==2.22
# via cffi
pydata-sphinx-theme==0.14.4
pydata-sphinx-theme==0.15.4
# via sphinx-book-theme
pygments==2.18.0
# via
Expand Down Expand Up @@ -262,24 +258,24 @@ snowballstemmer==2.2.0
# via sphinx
soupsieve==2.6
# via beautifulsoup4
sphinx==6.2.1
sphinx==8.0.0
# via
# -r requirements/doc.in
# pydata-sphinx-theme
# sphinx-book-theme
sphinx-book-theme==1.0.1
sphinx-book-theme==1.1.3
# via -r requirements/doc.in
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-devhelp==2.0.0
# via sphinx
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-htmlhelp==2.1.0
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sqlparse==0.5.1
# via django
Expand All @@ -291,7 +287,6 @@ tqdm==4.66.5
# via -r requirements/base.in
typing-extensions==4.12.2
# via
# asgiref
# django-countries
# edx-opaque-keys
# pydata-sphinx-theme
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --allow-unsafe --output-file=requirements/pip.txt requirements/pip.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip_tools.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand Down
7 changes: 1 addition & 6 deletions requirements/production.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand All @@ -9,10 +9,6 @@ asgiref==3.8.1
# django
# django-cors-headers
# django-countries
backports-zoneinfo==0.2.1
# via
# django
# djangorestframework
boto==2.49.0
# via -r requirements/base.in
boto3==1.35.8
Expand Down Expand Up @@ -249,7 +245,6 @@ tqdm==4.66.5
# via -r requirements/base.in
typing-extensions==4.12.2
# via
# asgiref
# django-countries
# edx-opaque-keys
tzdata==2024.1
Expand Down
7 changes: 1 addition & 6 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand All @@ -11,10 +11,6 @@ asgiref==3.8.1
# django-countries
astroid==2.3.3
# via pylint
backports-zoneinfo==0.2.1
# via
# django
# djangorestframework
boto==2.49.0
# via -r requirements/base.in
boto3==1.35.8
Expand Down Expand Up @@ -298,7 +294,6 @@ tqdm==4.66.5
# via -r requirements/base.in
typing-extensions==4.12.2
# via
# asgiref
# django-countries
# edx-opaque-keys
tzdata==2024.1
Expand Down
2 changes: 1 addition & 1 deletion requirements/tox.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist = True
envlist = py38-django{42}
envlist = py312-django{42}

[testenv]
passenv =
Expand Down

0 comments on commit 169da40

Please sign in to comment.