Skip to content

Conversation

@voyc-jean
Copy link

@voyc-jean voyc-jean commented Dec 9, 2025

Hello.

Django 5.1 deprecated the undocumented django.utils.itercompat module. Django 6.0 removed it entirely, which leads to this package breaking when imported.

@stephrdev / @codeinthehole Many components of this project are quite outdated at this point. Is there interest in getting things up to date? If so, would it be best to retain compatibility with EOL versions of Python and Django, or create a version 4.0 which only supports Django 5.2+ / Python 3.10+?

@stephrdev
Copy link
Collaborator

I could imagine having a new major release with support for only the last LTS of Django. No need to build a lot of compat code. Any help would be more than appreciated :) Feel free to udpate this PR introducing a new major release + required changes in testing/code. Thank you so much!

@voyc-jean
Copy link
Author

voyc-jean commented Dec 11, 2025

I could imagine having a new major release with support for only the last LTS of Django. No need to build a lot of compat code. Any help would be more than appreciated :) Feel free to udpate this PR introducing a new major release + required changes in testing/code. Thank you so much!

Hi @stephrdev

I've made these changes. I also felt like Docker compose would be preferred at this stage to Vagrant, as it allows easy reloading of Django by binding the sandbox directory to the container as a volume. Let me know if you disagree with this change.

Other changes include

  • Support for Python 3.10+
  • Support for Django 5.2+
  • Upgrade Poetry and dependencies to newer versions
  • Make use of Poetry dependency groups
  • Modernisation of Python code (3.10+ compatible)
  • Added Django debug toolbar to sandbox for easy cache debugging
  • Fixes various spelling errors / typos
  • Removal of deprecated functionality
  • Default to Redis as a cache backend in sandbox instead of Memcached

Tests are working in Github Actions on my repo and the sandbox seems to be fully functional.

Let me know if you have any questions.

@voyc-jean voyc-jean changed the title Fix Django 6 incompatibility Add Django 6 compatibility and modernise codebase Dec 11, 2025
Copy link
Collaborator

@stephrdev stephrdev left a comment

Choose a reason for hiding this comment

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

Really great work. Thank you for contributing to this project! Only a few minor notes. But I think we can get this merged even before the holidays :)


python:
version: 3.8
version: 3.10
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it make sense to upgrade to 3.14 right away?

set -xe
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade poetry tox tox-gh-actions
pip install --user poetry-plugin-export
Copy link
Collaborator

Choose a reason for hiding this comment

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

You cann add the extra install to the line above where we install poetry.

# --------------

@staticmethod
def is_iterable(value):
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we only use it once, I'd not have it as a separate method, especially not as a staticmethod :)

condition: service_healthy

redis:
image: redis:7-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
image: redis:7-alpine
image: redis:8-alpine

Or you can run the RQ implementation::

$ honcho -f Procfile.rq start
$ Q=rq docker compose up
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$ Q=rq docker compose up
$ QUEUE=rq docker compose up

Lets make it more verbose.

@@ -0,0 +1,20 @@
FROM python:3.12-slim
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
FROM python:3.12-slim
FROM python:3.14-slim

&& apt-get install -y --no-install-recommends build-essential \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
RUN pip install --upgrade pip \
RUN set -ex \
&& pip install --upgrade pip \

)

INTERNAL_IPS = ('10.0.2.2',)
_, _, ips = socket.gethostbyname_ex(socket.gethostname())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_, _, ips = socket.gethostbyname_ex(socket.gethostname())
ips = socket.gethostbyname_ex(socket.gethostname())[2]

CACHEBACK_TASK_QUEUE = dict([(q, q) for q in ('celery', 'rq')]).get(
os.environ.get('QUEUE', ''), 'celery')
CACHEBACK_TASK_QUEUE = {q: q for q in ('celery', 'rq')}.get(
os.environ.get('Q', ''), 'celery')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
os.environ.get('Q', ''), 'celery')
os.getenv('QUEUE', ''), 'celery')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants