dimagi / django-prbac

Other
139 stars 38 forks source link

Add support for Django 4.2 #72

Closed gherceg closed 11 months ago

gherceg commented 11 months ago

Python 3.7 has been EOLed, so remove that and run against newer versions of Python as well (3.10 and 3.11).

And in anticipation for Django 3.2 being EOLed in April 2024, we should update tests to run against both 3.2 and 4.2 LTS.

coveralls commented 11 months ago

Coverage Status

coverage: 90.491% (-0.08%) from 90.575% when pulling 538989a99f24ea2f330de223b2c694df0839d307 on gh/tests/update-versions into 43e1d2aae688e2a85231f8c928cb5e69a35e525e on master.

gherceg commented 11 months ago

I'm planning to create a separate PR officially adding support for 4.2 until I've done some due diligence, but passing tests is a promising start.

Update: I read through breaking changes introduced in 4.0 and feel confident that django-prbac is not relying on any of these. I'm thinking of updating the allowed django versions in this PR as well. Any thoughts @millerdev?

millerdev commented 11 months ago

:+1: Sounds good to me.

gherceg commented 11 months ago

I realized that the "tests passing on 4.2" before was due to pip install -e . uninstalling 4.2 and installing 3.2 based on the requirements of django-prbac:

(test-prbac) ⏺ code/django-prbac % pip install -e .                                                                                                        I
Obtaining file:///home/gherceg/dimagi/code/django-prbac
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Collecting simplejson
  Using cached simplejson-3.19.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (137 kB)
Collecting jsonfield<4,>=1.0.3
  Using cached jsonfield-3.1.0-py3-none-any.whl (8.0 kB)
Collecting django!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,!=3.0.4,!=3.0.5,!=3.0.6,<4,>=2.2.13
  Using cached Django-3.2.23-py3-none-any.whl (7.9 MB)
Requirement already satisfied: asgiref<4,>=3.3.2 in /home/gherceg/.pyenv/versions/3.10.13/envs/test-prbac/lib/python3.10/site-packages (from django!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,!=3.0.4,!=3.0.5,!=3.0.6,<4,>=2.2.13->django-prbac==1.0.1) (3.7.2)
Requirement already satisfied: sqlparse>=0.2.2 in /home/gherceg/.pyenv/versions/3.10.13/envs/test-prbac/lib/python3.10/site-packages (from django!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,!=3.0.4,!=3.0.5,!=3.0.6,<4,>=2.2.13->django-prbac==1.0.1) (0.4.4)
Collecting pytz
  Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)
Requirement already satisfied: typing-extensions>=4 in /home/gherceg/.pyenv/versions/3.10.13/envs/test-prbac/lib/python3.10/site-packages (from asgiref<4,>=3.3.2->django!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,!=3.0.4,!=3.0.5,!=3.0.6,<4,>=2.2.13->django-prbac==1.0.1) (4.8.0)
Building wheels for collected packages: django-prbac
  Building editable for django-prbac (pyproject.toml) ... done
  Created wheel for django-prbac: filename=django_prbac-1.0.1-0.editable-py2.py3-none-any.whl size=5489 sha256=e60fd515114b09e4631fc606fbcb32f47f9f88621964cc74d83cb3fbe811c5cc
  Stored in directory: /tmp/pip-ephem-wheel-cache-hur7cz7q/wheels/bd/da/41/b249f1a4df4f534ff0409ca07b413ddbd1999f217a44ba2f6a
Successfully built django-prbac
Installing collected packages: pytz, simplejson, django, jsonfield, django-prbac
  Attempting uninstall: django
    Found existing installation: Django 4.2.7
    Uninstalling Django-4.2.7:
      Successfully uninstalled Django-4.2.7
Successfully installed django-3.2.23 django-prbac-1.0.1 jsonfield-3.1.0 pytz-2023.3.post1 simplejson-3.19.2

There were a couple of changes in Django 4 that needed to be addressed here:

I've addressed these in this PR as well, so tests for 4.2 now pass.