Skip to content

Commit ebf8f77

Browse files
authored
Add support for python 3.12 (#274)
* fix: add support for python 3.12 * fix: python version in docker file * fix: add comments about changes
1 parent ead29e1 commit ebf8f77

File tree

7 files changed

+30
-10
lines changed

7 files changed

+30
-10
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python_version: ['3.11']
15+
python_version: ['3.11', '3.12']
1616
ubuntu_version: ['22.04', '24.04']
1717
tox_env: [ "django42", "django52"]
1818
include:
1919
- tox_env: quality
2020
ubuntu_version: '24.04'
21-
python_version: '3.11'
21+
python_version: '3.12'
2222

2323
steps:
2424
- uses: actions/checkout@v5

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Unreleased
1616

1717
*
1818

19+
4.1.0 - 2025-11-04
20+
******************
21+
22+
* Adds support for Python 3.12
23+
1924
4.0.0 - 2025-06-13
2025
******************
2126

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,24 @@ ENV TZ=Etc/UTC
1414
ENV DEBIAN_FRONTEND=noninteractive
1515
RUN apt-get update && apt-get install -y software-properties-common
1616
RUN add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt-get upgrade -y
17-
RUN apt-get install -y vim python${python_version} python${python_version}-dev python${python_version}-distutils
17+
# ---------------------------------------------------------------------------
18+
# - The "distutils" module was removed in Python 3.12 (PEP 632).
19+
# - To ensure virtualenv creation still works, we now prefer python3-venv instead.
20+
# - Older Python versions (e.g., 3.11) still support distutils, so we keep the
21+
# fallback to install python3-distutils if needed.
22+
# ---------------------------------------------------------------------------
23+
RUN apt-get install -y vim python${python_version} python${python_version}-dev python${python_version}-venv || \
24+
apt-get install -y vim python${python_version} python${python_version}-dev python3-distutils
1825
RUN apt-get install -y sudo git make curl build-essential
19-
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${python_version}
20-
RUN pip install virtualenv
26+
# ---------------------------------------------------------------------------
27+
# - Ubuntu 24.04 enforces "externally-managed-environment" per PEP 668,
28+
# which prevents pip from modifying system packages by default.
29+
# - We explicitly add "--break-system-packages" to allow pip installs inside
30+
# the container environment (since it's isolated anyway).
31+
# ---------------------------------------------------------------------------
32+
RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
33+
python${python_version} get-pip.py --break-system-packages && rm get-pip.py
34+
RUN pip install virtualenv --break-system-packages
2135

2236
# Define Environment Variables
2337
ENV CODEJAIL_GROUP=sandbox

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This library currently is tested to work with the following versions
4444
Python:
4545

4646
* 3.11
47+
* 3.12
4748

4849
Ubuntu:
4950

@@ -80,7 +81,7 @@ Other details here that depend on your configuration:
8081

8182
1. Create the new virtualenv, using ``--copies`` so that there's a distinct Python executable to limit::
8283

83-
$ sudo python3.11 -m venv --copies <SANDENV>
84+
$ sudo python3.12 -m venv --copies <SANDENV>
8485

8586
By default, the virtualenv would just symlink against the system Python, and apparmor's default configuration on some operating systems may prevent confinement from being appled to that.
8687

codejail/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""init"""
22

3-
__version__ = '4.0.0'
3+
__version__ = '4.1.0'

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import re
44

5-
from setuptools import find_packages, setup
5+
from setuptools import find_packages, setup # pylint: disable=import-error
66

77
with open('README.rst') as readme:
88
long_description = readme.read()
@@ -51,7 +51,7 @@ def get_version(*file_paths):
5151
"Intended Audience :: Developers",
5252
'Programming Language :: Python',
5353
'Programming Language :: Python :: 3',
54-
'Programming Language :: Python :: 3.8',
5554
'Programming Language :: Python :: 3.11',
55+
'Programming Language :: Python :: 3.12',
5656
],
5757
)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = django{42,52}
2+
envlist = django{42,52},quality
33

44
[testenv]
55
passenv =

0 commit comments

Comments
 (0)