Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add python312 support #780

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [py38]
python-version: ['3.8', '3.12']
django-version: [django42]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Start container
run: |
docker-compose -f .github/docker-compose-github.yml up -d
- name: Install test dependencies and run validation
run: |
docker exec -e TOXENV=${{ matrix.python-version }}-${{ matrix.django-version }} -u root enterprise.catalog.app /edx/app/enterprise_catalog/enterprise_catalog/validate.sh
if [[ "${{ matrix.python-version }}" == "3.8" ]]; then
docker exec -e TOXENV=py38-${{ matrix.django-version }} -u root enterprise.catalog.app /edx/app/enterprise_catalog/enterprise_catalog/validate.sh
elif [[ "${{ matrix.python-version }}" == "3.12" ]]; then
docker exec -e TOXENV=py312-${{ matrix.django-version }} -u root enterprise.catalog.app /edx/app/enterprise_catalog/enterprise_catalog/validate.sh
fi
- name: Code Coverage
if: matrix.python-version == 'py38' && matrix.django-version=='django42'
if: matrix.python-version == '3.8' && matrix.django-version=='django42'
uses: codecov/codecov-action@v1
2 changes: 1 addition & 1 deletion .github/workflows/mysql-migrations-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
pip uninstall -y mysqlclient
pip install --no-binary mysqlclient mysqlclient
pip uninstall -y xmlsec
pip install --no-binary xmlsec xmlsec
pip install --no-binary xmlsec xmlsec==1.3.13
- name: Initiate services
run: |
sudo /etc/init.d/mysql start
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ RUN apt-get update && apt-get -qy install --no-install-recommends \
git \
wget

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

RUN apt-get update && apt-get -qy install libffi-dev libsqlite3-dev python3-distutils

RUN apt-get update && apt-get install -y build-essential wget && \
Copy link
Member

Choose a reason for hiding this comment

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

Installing Python 3.12 from source to make it available for test runners within the test container.

wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz && \
tar -xzvf Python-3.12.0.tgz && cd Python-3.12.0 && ./configure --enable-optimizations && \
make -j$(nproc) && make altinstall && python3.12 --version

ENV VIRTUAL_ENV=/venv
RUN python3.8 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ piptools: ## install pinned version of pip-compile and pip-sync

requirements: piptools dev_requirements ## sync to default requirements

requirements312: ## sync to requirements for local development with Python 3.12
pip3.12 install -qr requirements/pip-tools.txt
pip3.12 install -qr requirements/dev312.txt

dev_requirements: ## sync to requirements for local development
pip-sync -q requirements/dev.txt

Expand Down Expand Up @@ -99,9 +103,8 @@ html_coverage: ## generate and view HTML coverage report
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: $(COMMON_CONSTRAINTS_TXT) piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
# Make sure to compile files after any other files they include!
sed 's/Django<4.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp
sed 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp
mv requirements/common_constraints.tmp requirements/common_constraints.txt
sed -i 's/django-simple-history==//g' requirements/common_constraints.txt
pip-compile --allow-unsafe --rebuild --upgrade -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
Expand Down
2 changes: 1 addition & 1 deletion enterprise_catalog/apps/api_client/tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def test_retrieve_course_reviews_with_successful_response(
"total_enrollments": 300
}
})
assert mock_sleep.not_called()
mock_sleep.assert_not_called()

@mock.patch('enterprise_catalog.apps.api_client.discovery.time.sleep')
@mock.patch('enterprise_catalog.apps.api_client.discovery.LOGGER')
Expand Down
5 changes: 3 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ attrs==23.2.0
# referencing
backoff==1.10.0
# via analytics-python
backports-zoneinfo[tzdata]==0.2.1
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
celery==5.3.6
celery==5.4.0
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/common_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Django<5.0
elasticsearch<7.14.0

# django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected
3.0.0


# opentelemetry requires version 6.x at the moment:
# https://github.com/open-telemetry/opentelemetry-python/issues/3570
Expand Down
3 changes: 3 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ astroid<2.12

# To avoid any breaking changes
openai<=1.13.3

# For python greater than or equal to 3.9 backports.zoneinfo causing failures
backports.zoneinfo; python_version<'3.9'
11 changes: 6 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ backoff==1.10.0
# -r requirements/quality.txt
# -r requirements/test.txt
# analytics-python
backports-zoneinfo[tzdata]==0.2.1
backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# -r requirements/quality.txt
# -r requirements/test.txt
# celery
Expand All @@ -74,7 +75,7 @@ cachetools==5.3.3
# via
# -r requirements/test.txt
# tox
celery==5.3.6
celery==5.4.0
# via
# -c requirements/constraints.txt
# -r requirements/quality.txt
Expand Down Expand Up @@ -351,7 +352,7 @@ exceptiongroup==1.2.0
# pytest
factory-boy==3.3.0
# via -r requirements/test.txt
faker==24.9.0
faker==24.11.0
# via
# -r requirements/test.txt
# factory-boy
Expand All @@ -360,7 +361,7 @@ filelock==3.13.4
# -r requirements/test.txt
# tox
# virtualenv
gunicorn==21.2.0
gunicorn==22.0.0
# via -r requirements/dev.in
h11==0.14.0
# via
Expand Down Expand Up @@ -858,7 +859,7 @@ vine==5.1.0
# amqp
# celery
# kombu
virtualenv==20.25.1
virtualenv==20.25.3
# via
# -r requirements/test.txt
# tox
Expand Down
Loading
Loading