From a504edf55b324a08bf0f540d7aed890c549f42b9 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Tue, 29 Oct 2024 19:04:34 +0100 Subject: [PATCH 1/2] Upgraded to Python 3.11 --- .github/workflows/tests.yml | 43 +++++++++++++++++++++---------------- Dockerfile | 2 +- requirements.txt | 4 ++++ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 05e81ba..b52800e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,51 +13,56 @@ concurrency: permissions: contents: read +env: + DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests + PYTHONWARNINGS: > + error, + default:::passlib.utils, + jobs: noshadows: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.11' - run: pip install "tinycss2>=1.2.0" - run: python noshadows.py --tests - env: - PYTHONWARNINGS: error tracdjangoplugin: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.11' + - name: Install system package dependencies + run: | + sudo apt-get update + sudo apt-get -y install subversion - name: Install requirements run: python -m pip install -r requirements.txt - name: Run tests run: python -m django test tracdjangoplugin.tests - env: - DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests - PYTHONWARNINGS: error traccheck: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.11' + - name: Install system package dependencies + run: | + sudo apt-get update + sudo apt-get -y install subversion - name: Install requirements run: python -m pip install -r requirements.txt - - run: python traccheck.py lint trac-env/ - env: - DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests - PYTHONWARNINGS: error - - run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ - env: - DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests - PYTHONWARNINGS: error + - name: Lint Trac configuration + run: python traccheck.py lint trac-env/ + - name: Check frozen Trac components + run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ diff --git a/Dockerfile b/Dockerfile index f7691c6..e385073 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM python:3.8-slim-bullseye +FROM python:3.12-slim-bookworm # set work directory WORKDIR /code diff --git a/requirements.txt b/requirements.txt index 6d6c78a..048d462 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,10 @@ psycopg2==2.9.9 --no-binary=psycopg2 Django==4.2.16 libsass==0.23.0 +# Optional Trac dependencies that make DeprecationWarning go away +multipart==1.1.0 +passlib==1.7.4 + # Trac plugins TracSpamFilter[dns,spambayes] @ svn+https://svn.edgewall.org/repos/trac/plugins/trunk/spam-filter@17766 TracDragDrop @ svn+https://trac-hacks.org/svn/tracdragdropplugin/0.12@18635 From afcf25bf5bbb4ac14947558ee8c9198ebfc9ed93 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Sat, 2 Nov 2024 11:43:14 +0100 Subject: [PATCH 2/2] Fixed docker image and added comments after review --- .github/workflows/tests.yml | 2 ++ Dockerfile | 2 +- requirements.txt | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b52800e..9ed0b00 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,8 @@ permissions: env: DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests + # passlib has a conditional import for `crypt` which is going away in python 3.13 + # and therefore throwing warnings PYTHONWARNINGS: > error, default:::passlib.utils, diff --git a/Dockerfile b/Dockerfile index e385073..afdb103 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM python:3.12-slim-bookworm +FROM python:3.11-slim-bookworm # set work directory WORKDIR /code diff --git a/requirements.txt b/requirements.txt index 048d462..166a748 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,9 @@ psycopg2==2.9.9 --no-binary=psycopg2 Django==4.2.16 libsass==0.23.0 -# Optional Trac dependencies that make DeprecationWarning go away +# Optional Trac dependencies that make DeprecationWarning go away. +# When upgrading Trac or Python, check if these dependencies are still needed +# by uninstalling them and running the test suite (or CI) with PYTHONWARNINGS=error multipart==1.1.0 passlib==1.7.4