Skip to content

Commit

Permalink
feat!: Python 3.12 upgrade (#473)
Browse files Browse the repository at this point in the history
* feat: Upgrade python312 CI

* build: update Dockerfile

* feat: Upgrade packages using python 3.12

---------

Co-authored-by: Usama Sadiq <[email protected]>
  • Loading branch information
brobro10000 and UsamaSadiq committed May 21, 2024
1 parent 661ece1 commit eeab72f
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 387 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.12"]
python-version: ["3.12"]
django-version: ["pinned"]
steps:
- uses: actions/checkout@v2
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 @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.12"]

steps:
- name: setup target branch
Expand Down
34 changes: 27 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,48 @@ MAINTAINER [email protected]

# gcc; for compiling python extensions distributed with python packages like mysql-client

# 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

# If you add a package here please include a comment above describing what it is used for
RUN apt-get update && apt-get -qy install --no-install-recommends \
build-essential \
language-pack-en \
locales \
python3.8 \
python3-pip \
python3.8-venv \
python3.8-dev \
pkg-config \
libmysqlclient-dev \
libssl-dev \
build-essential \
git \
wget
wget \
curl \
libffi-dev \
libsqlite3-dev \
python3-pip \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-distutils

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN pip install --upgrade pip setuptools
# delete apt package lists because we do not need them inflating our image
RUN rm -rf /var/lib/apt/lists/*

# 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

# Create a virtualenv for sanity
ENV VIRTUAL_ENV=/edx/venvs/enterprise-access
RUN python3.8 -m venv $VIRTUAL_ENV
RUN virtualenv -p python${PYTHON_VERSION} $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR /tmp
Expand Down
32 changes: 5 additions & 27 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 @@ -13,21 +13,13 @@ asgiref==3.8.1
# django
# django-cors-headers
# django-simple-history
async-timeout==4.0.3
# via redis
attrs==23.2.0
# via
# jsonschema
# openedx-events
# referencing
backoff==1.10.0
# via analytics-python
backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# kombu
billiard==4.2.0
# via celery
celery==5.4.0
Expand Down Expand Up @@ -206,10 +198,6 @@ fastavro==1.9.4
# openedx-events
idna==3.7
# via requests
importlib-resources==6.4.0
# via
# jsonschema
# jsonschema-specifications
inflection==0.5.1
# via
# drf-spectacular
Expand All @@ -236,7 +224,7 @@ monotonic==1.6
# via analytics-python
mysqlclient==2.2.4
# via -r requirements/base.in
newrelic==9.9.0
newrelic==9.9.1
# via edx-django-utils
oauthlib==3.2.2
# via
Expand All @@ -252,8 +240,6 @@ packaging==24.0
# via drf-yasg
pbr==6.0.0
# via stevedore
pkgutil-resolve-name==1.3.10
# via jsonschema
ply==3.11
# via djangoql
prompt-toolkit==3.0.43
Expand Down Expand Up @@ -317,7 +303,7 @@ rpds-py==0.18.1
# via
# jsonschema
# referencing
rules==3.3
rules==3.4
# via -r requirements/base.in
semantic-version==2.10.0
# via edx-drf-extensions
Expand Down Expand Up @@ -349,15 +335,9 @@ stevedore==5.2.0
text-unidecode==1.3
# via python-slugify
typing-extensions==4.11.0
# via
# asgiref
# drf-spectacular
# edx-opaque-keys
# kombu
# via edx-opaque-keys
tzdata==2024.1
# via
# backports-zoneinfo
# celery
# via celery
uritemplate==4.1.1
# via
# coreapi
Expand All @@ -372,8 +352,6 @@ vine==5.1.0
# kombu
wcwidth==0.2.13
# via prompt-toolkit
zipp==3.18.1
# via importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# setuptools
77 changes: 13 additions & 64 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 @@ -16,15 +16,11 @@ asgiref==3.8.1
# django
# django-cors-headers
# django-simple-history
astroid==3.1.0
astroid==3.2.2
# via
# -r requirements/validation.txt
# pylint
# pylint-celery
async-timeout==4.0.3
# via
# -r requirements/validation.txt
# redis
attrs==23.2.0
# via
# -r requirements/validation.txt
Expand All @@ -35,16 +31,6 @@ backoff==1.10.0
# via
# -r requirements/validation.txt
# analytics-python
backports-tarfile==1.1.1
# via
# -r requirements/validation.txt
# jaraco-context
backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -r requirements/validation.txt
# celery
# django
# kombu
billiard==4.2.0
# via
# -r requirements/validation.txt
Expand Down Expand Up @@ -241,7 +227,7 @@ dnspython==2.6.1
# via
# -r requirements/validation.txt
# pymongo
docutils==0.20.1
docutils==0.21.2
# via
# -r requirements/validation.txt
# readme-renderer
Expand Down Expand Up @@ -305,13 +291,9 @@ edx-toggles==5.2.0
# via
# -r requirements/validation.txt
# edx-event-bus-kafka
exceptiongroup==1.2.1
# via
# -r requirements/validation.txt
# pytest
factory-boy==3.3.0
# via -r requirements/validation.txt
faker==25.1.0
faker==25.2.0
# via
# -r requirements/validation.txt
# factory-boy
Expand All @@ -332,17 +314,8 @@ idna==3.7
# requests
importlib-metadata==6.11.0
# via
# -r requirements/pip-tools.txt
# -r requirements/validation.txt
# build
# keyring
# twine
importlib-resources==6.4.0
# via
# -r requirements/validation.txt
# jsonschema
# jsonschema-specifications
# keyring
inflection==0.5.1
# via
# -r requirements/validation.txt
Expand Down Expand Up @@ -397,7 +370,7 @@ jsonschema-specifications==2023.12.1
# via
# -r requirements/validation.txt
# jsonschema
keyring==25.2.0
keyring==25.2.1
# via
# -r requirements/validation.txt
# twine
Expand Down Expand Up @@ -438,7 +411,7 @@ more-itertools==10.2.0
# jaraco-functools
mysqlclient==2.2.4
# via -r requirements/validation.txt
newrelic==9.9.0
newrelic==9.9.1
# via
# -r requirements/validation.txt
# edx-django-utils
Expand Down Expand Up @@ -480,11 +453,7 @@ pkginfo==1.10.0
# via
# -r requirements/validation.txt
# twine
pkgutil-resolve-name==1.3.10
# via
# -r requirements/validation.txt
# jsonschema
platformdirs==4.2.1
platformdirs==4.2.2
# via
# -r requirements/validation.txt
# pylint
Expand Down Expand Up @@ -532,7 +501,7 @@ pyjwt[crypto]==2.8.0
# edx-drf-extensions
# edx-rest-api-client
# social-auth-core
pylint==3.1.1
pylint==3.2.2
# via
# -r requirements/validation.txt
# edx-lint
Expand Down Expand Up @@ -571,7 +540,7 @@ pyproject-hooks==1.1.0
# -r requirements/pip-tools.txt
# build
# pip-tools
pytest==8.2.0
pytest==8.2.1
# via
# -r requirements/validation.txt
# pytest-cov
Expand Down Expand Up @@ -652,7 +621,7 @@ rpds-py==0.18.1
# -r requirements/validation.txt
# jsonschema
# referencing
rules==3.3
rules==3.4
# via -r requirements/validation.txt
secretstorage==3.3.3
# via
Expand Down Expand Up @@ -708,39 +677,21 @@ text-unidecode==1.3
# via
# -r requirements/validation.txt
# python-slugify
tomli==2.0.1
# via
# -r requirements/pip-tools.txt
# -r requirements/validation.txt
# build
# coverage
# pip-tools
# pylint
# pyproject-api
# pytest
# tox
tomlkit==0.12.5
# via
# -r requirements/validation.txt
# pylint
tox==4.15.0
# via -r requirements/validation.txt
twine==5.0.0
twine==5.1.0
# via -r requirements/validation.txt
typing-extensions==4.11.0
# via
# -r requirements/validation.txt
# asgiref
# astroid
# drf-spectacular
# edx-opaque-keys
# kombu
# pylint
# rich
tzdata==2024.1
# via
# -r requirements/validation.txt
# backports-zoneinfo
# celery
uritemplate==4.1.1
# via
Expand All @@ -759,7 +710,7 @@ vine==5.1.0
# amqp
# celery
# kombu
virtualenv==20.26.1
virtualenv==20.26.2
# via
# -r requirements/validation.txt
# tox
Expand All @@ -771,12 +722,10 @@ wheel==0.43.0
# via
# -r requirements/pip-tools.txt
# pip-tools
zipp==3.18.1
zipp==3.18.2
# via
# -r requirements/pip-tools.txt
# -r requirements/validation.txt
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
Loading

0 comments on commit eeab72f

Please sign in to comment.