Skip to content

Commit

Permalink
Merge pull request #28 from edx/jenkins/python312-support-4958920
Browse files Browse the repository at this point in the history
feat: add python 3.12 support
  • Loading branch information
UsamaSadiq authored Feb 26, 2024
2 parents 7bf1cec + 3e983d8 commit 32fc557
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 79 deletions.
67 changes: 40 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Python CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches:
- '**'
- '**'


jobs:
Expand All @@ -15,30 +15,43 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.9']
toxenv: ["py39", "quality", "docs", "pii_check"]
python-version:
- '3.9'
- '3.12'
toxenv:
- "py39"
- "py312"
- "quality"
- "docs"
- "pii_check"
exclude:
- python-version: '3.9'
toxenv: 'py312'
- python-version: '3.12'
toxenv: 'py39'


steps:
- uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run coverage
if: matrix.python-version == '3.9' && matrix.toxenv == 'py39'
uses: codecov/codecov-action@v3
with:
flags: unittests
fail_ci_if_error: true
- uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run coverage
if: matrix.python-version == '3.9' && matrix.toxenv == 'py39'
uses: codecov/codecov-action@v3
with:
flags: unittests
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ html_coverage: ## generate and view HTML coverage report
coverage html && open htmlcov/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)
PIP_COMPILE = pip-compile --upgrade --allow-unsafe $(PIP_COMPILE_OPTS)

COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
.PHONY: $(COMMON_CONSTRAINTS_TXT)
Expand All @@ -109,7 +109,7 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with t
mv requirements/common_constraints.tmp requirements/common_constraints.txt
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
Expand Down
2 changes: 1 addition & 1 deletion flashcards/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
flashcards module.
"""
__version__ = '0.1.0'
__version__ = '0.1.1'
2 changes: 2 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ genanki # used to generate Anki flash card deck files convenient
mysqlclient
openai # OpenAI library used to generate flash card candidates from course content
pytz
setuptools #setuptools is needed for Python 3.12
backports.zoneinfo;python_version<"3.9" # Can be removed once we upgrade to Python 3.12
8 changes: 5 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ defusedxml==0.8.0rc2
# python3-openid
# social-auth-core
distro==1.9.0
# via
# anki
# openai
# via openai
django==4.2.10
# via
# -r requirements/base.in
Expand Down Expand Up @@ -237,3 +235,7 @@ urllib3==2.2.1
# via requests
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==69.1.1
# via -r requirements/base.in
1 change: 1 addition & 0 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


# A central location for most common version constraints
# (across edx repos) for pip-installation.
#
Expand Down
22 changes: 9 additions & 13 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ cryptography==42.0.5
# via
# -r requirements/validation.txt
# pyjwt
# secretstorage
# social-auth-core
decorator==5.1.1
# via
Expand All @@ -127,7 +126,6 @@ distlib==0.3.8
distro==1.9.0
# via
# -r requirements/validation.txt
# anki
# openai
django==4.2.10
# via
Expand Down Expand Up @@ -257,11 +255,6 @@ jaraco-classes==3.3.1
# via
# -r requirements/validation.txt
# keyring
jeepney==0.8.0
# via
# -r requirements/validation.txt
# keyring
# secretstorage
jinja2==3.1.3
# via
# -r requirements/validation.txt
Expand Down Expand Up @@ -496,10 +489,6 @@ rich==13.7.0
# via
# -r requirements/validation.txt
# twine
secretstorage==3.3.3
# via
# -r requirements/validation.txt
# keyring
semantic-version==2.10.0
# via
# -r requirements/validation.txt
Expand Down Expand Up @@ -615,5 +604,12 @@ zipp==3.17.0
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
pip==24.0
# via
# -r requirements/pip-tools.txt
# pip-tools
setuptools==69.1.1
# via
# -r requirements/pip-tools.txt
# -r requirements/validation.txt
# pip-tools
12 changes: 4 additions & 8 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ cryptography==42.0.5
# via
# -r requirements/test.txt
# pyjwt
# secretstorage
# social-auth-core
decorator==5.1.1
# via
Expand All @@ -129,7 +128,6 @@ distlib==0.3.8
distro==1.9.0
# via
# -r requirements/test.txt
# anki
# openai
django==4.2.10
# via
Expand Down Expand Up @@ -258,10 +256,6 @@ itypes==1.2.0
# coreapi
jaraco-classes==3.3.1
# via keyring
jeepney==0.8.0
# via
# keyring
# secretstorage
jinja2==3.1.3
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -469,8 +463,6 @@ rfc3986==2.0.0
# via twine
rich==13.7.0
# via twine
secretstorage==3.3.3
# via keyring
semantic-version==2.10.0
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -596,3 +588,7 @@ zipp==3.17.0
# via
# -r requirements/test.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==69.1.1
# via -r requirements/test.txt
6 changes: 4 additions & 2 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
pip==24.0
# via pip-tools
setuptools==69.1.1
# via pip-tools
7 changes: 5 additions & 2 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ defusedxml==0.8.0rc2
distro==1.9.0
# via
# -r requirements/base.txt
# anki
# openai
django==4.2.10
# via
Expand Down Expand Up @@ -364,4 +363,8 @@ zope-interface==6.2
# via gevent

# The following packages are considered to be unsafe in a requirements file:
# setuptools
setuptools==69.1.1
# via
# -r requirements/base.txt
# zope-event
# zope-interface
12 changes: 4 additions & 8 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ cryptography==42.0.5
# via
# -r requirements/test.txt
# pyjwt
# secretstorage
# social-auth-core
decorator==5.1.1
# via
Expand All @@ -118,7 +117,6 @@ distlib==0.3.8
distro==1.9.0
# via
# -r requirements/test.txt
# anki
# openai
django==4.2.10
# via
Expand Down Expand Up @@ -239,10 +237,6 @@ itypes==1.2.0
# coreapi
jaraco-classes==3.3.1
# via keyring
jeepney==0.8.0
# via
# keyring
# secretstorage
jinja2==3.1.3
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -437,8 +431,6 @@ rfc3986==2.0.0
# via twine
rich==13.7.0
# via twine
secretstorage==3.3.3
# via keyring
semantic-version==2.10.0
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -540,3 +532,7 @@ zipp==3.17.0
# via
# -r requirements/test.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==69.1.1
# via -r requirements/test.txt
5 changes: 4 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ distlib==0.3.8
distro==1.9.0
# via
# -r requirements/base.txt
# anki
# openai
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -447,3 +446,7 @@ zipp==3.17.0
# via
# -r requirements/base.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==69.1.1
# via -r requirements/base.txt
17 changes: 6 additions & 11 deletions requirements/validation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ cryptography==42.0.5
# -r requirements/quality.txt
# -r requirements/test.txt
# pyjwt
# secretstorage
# social-auth-core
decorator==5.1.1
# via
Expand All @@ -145,7 +144,6 @@ distro==1.9.0
# via
# -r requirements/quality.txt
# -r requirements/test.txt
# anki
# openai
django==4.2.10
# via
Expand Down Expand Up @@ -305,11 +303,6 @@ jaraco-classes==3.3.1
# via
# -r requirements/quality.txt
# keyring
jeepney==0.8.0
# via
# -r requirements/quality.txt
# keyring
# secretstorage
jinja2==3.1.3
# via
# -r requirements/quality.txt
Expand Down Expand Up @@ -566,10 +559,6 @@ rich==13.7.0
# via
# -r requirements/quality.txt
# twine
secretstorage==3.3.3
# via
# -r requirements/quality.txt
# keyring
semantic-version==2.10.0
# via
# -r requirements/quality.txt
Expand Down Expand Up @@ -694,3 +683,9 @@ zipp==3.17.0
# -r requirements/quality.txt
# -r requirements/test.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
setuptools==69.1.1
# via
# -r requirements/quality.txt
# -r requirements/test.txt
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py39-django{42}, quality, docs, pii_check
envlist = py{39, 312}-django{42}, quality, docs, pii_check
skipsdist = true

[doc8]
Expand Down

0 comments on commit 32fc557

Please sign in to comment.