Skip to content

Commit

Permalink
Merge pull request #655 from openedx/python312-upgrade
Browse files Browse the repository at this point in the history
feat!: Python 3.12 Upgrade
  • Loading branch information
macdiesel authored Jul 30, 2024
2 parents 6fffc31 + ed82251 commit 19e8dfd
Show file tree
Hide file tree
Showing 17 changed files with 140 additions and 374 deletions.
4 changes: 2 additions & 2 deletions .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.11", "3.12"]
python-version: ["3.12"]
django-version: ["pinned"]
steps:
- uses: actions/checkout@v2
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11", "3.12"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql8-migrations-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-20.04 ]
python-version: [ 3.8 ]
python-version: [ 3.12 ]

steps:
- name: Checkout repo
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
with:
branch: ${{ github.event.inputs.branch || 'master' }}
python_version: "3.12"
# optional parameters below; fill in if you'd like github or email notifications
# user_reviewers: ""
# team_reviewers: ""
Expand Down
31 changes: 25 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,42 @@ MAINTAINER [email protected]
# unzip to unzip a watchman binary archive

# If you add a package here please include a comment above describing what it is used for

# 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

RUN apt-get update && apt-get -qy install --no-install-recommends \
language-pack-en \
locales \
python3.8 \
python3-pip \
python3.8-venv \
python3.8-dev \
pkg-config \
libmysqlclient-dev \
libssl-dev \
build-essential \
git \
wget \
unzip
unzip \
curl \
libffi-dev \
libsqlite3-dev \
python3-pip \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-distutils

# 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

ENV VIRTUAL_ENV=/edx/app/license-manager/venvs/license-manager
RUN python3.8 -m venv $VIRTUAL_ENV
RUN virtualenv -p python${PYTHON_VERSION} $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN locale-gen en_US.UTF-8
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt fil
# This is a temporary solution to override the real common_constraints.txt
# In edx-lint, until the pyjwt constraint in edx-lint has been removed.
# See BOM-271 for more details.
sed -i 's/Django<4.0//g' requirements/common_constraints.txt
sed -i 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt
# Make sure to compile files after any other files they include!
pip-compile --upgrade --rebuild --allow-unsafe -o requirements/pip.txt requirements/pip.in
Expand Down
2 changes: 1 addition & 1 deletion license_manager/apps/subscriptions/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _original_licenses_to_copy(original_plan, license_types_to_copy):
elif license_types_to_copy == LicenseTypesToRenew.ACTIVATED:
license_status_kwargs = {'status': ACTIVATED}

return list(original_plan.licenses.filter(**license_status_kwargs))
return list(original_plan.licenses.filter(**license_status_kwargs)) # pylint: disable=possibly-used-before-assignment


def delete_unused_licenses_post_freeze(subscription_plan):
Expand Down
43 changes: 10 additions & 33 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 @@ -12,8 +12,6 @@ asgiref==3.8.1
# via
# django
# django-cors-headers
async-timeout==4.0.3
# via redis
attrs==23.2.0
# via
# jsonschema
Expand All @@ -22,18 +20,11 @@ backoff==1.10.0
# via
# -r requirements/base.in
# analytics-python
backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# djangorestframework
# kombu
billiard==4.2.0
# via celery
boto3==1.34.144
boto3==1.34.150
# via django-ses
botocore==1.34.144
botocore==1.34.150
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -66,7 +57,7 @@ click-repl==0.3.0
# via celery
code-annotations==1.8.0
# via edx-toggles
cryptography==42.0.8
cryptography==43.0.0
# via
# pyjwt
# social-auth-core
Expand Down Expand Up @@ -182,10 +173,6 @@ edx-toggles==5.2.0
# via -r requirements/base.in
idna==3.7
# via requests
importlib-resources==6.4.0
# via
# jsonschema
# jsonschema-specifications
inflection==0.5.1
# via drf-spectacular
jinja2==3.1.4
Expand Down Expand Up @@ -216,8 +203,6 @@ oauthlib==3.2.2
# social-auth-core
pbr==6.0.0
# via stevedore
pkgutil-resolve-name==1.3.10
# via jsonschema
ply==3.11
# via djangoql
prompt-toolkit==3.0.47
Expand Down Expand Up @@ -270,7 +255,7 @@ requests==2.32.3
# social-auth-core
requests-oauthlib==2.0.0
# via social-auth-core
rpds-py==0.19.0
rpds-py==0.19.1
# via
# jsonschema
# referencing
Expand All @@ -296,7 +281,7 @@ social-auth-core==4.5.4
# via
# edx-auth-backends
# social-auth-app-django
sqlparse==0.5.0
sqlparse==0.5.1
# via django
stevedore==5.2.0
# via
Expand All @@ -306,18 +291,12 @@ stevedore==5.2.0
text-unidecode==1.3
# via python-slugify
typing-extensions==4.12.2
# 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 drf-spectacular
urllib3==1.26.19
urllib3==2.2.2
# via
# botocore
# requests
Expand All @@ -329,9 +308,7 @@ vine==5.1.0
wcwidth==0.2.13
# via prompt-toolkit
zipp==3.19.2
# via
# -r requirements/base.in
# importlib-resources
# via -r requirements/base.in

# The following packages are considered to be unsafe in a requirements file:
# setuptools
8 changes: 8 additions & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Django<5.0

# elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process.
# elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html
# See https://github.com/openedx/edx-platform/issues/35126 for more info
elasticsearch<7.14.0

# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected
Expand All @@ -35,3 +36,10 @@ elasticsearch<7.14.0
# So we need to pin it globally, for now.
# Ticket for unpinning: https://github.com/openedx/edx-lint/issues/407
importlib-metadata<7

# Cause: https://github.com/openedx/event-tracking/pull/290
# event-tracking 2.4.1 upgrades to pymongo 4.4.0 which is not supported on edx-platform.
# We will pin event-tracking to do not break existing installations
# This can be unpinned once https://github.com/openedx/edx-platform/issues/34586
# has been resolved and edx-platform is running with pymongo>=4.4.0
event-tracking<2.4.1
3 changes: 3 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ diff-cover==4.0.0

# For python greater than or equal to 3.9 backports.zoneinfo is causing failures
backports.zoneinfo;python_version<"3.9"

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

0 comments on commit 19e8dfd

Please sign in to comment.