From 27a62e6e671a4762913541121ad72903e0b61cd7 Mon Sep 17 00:00:00 2001 From: Jens Nistler <366967+lociii@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:37:12 +0200 Subject: [PATCH] Add Django 5.0/5.1 and Python 3.10/3.11/3.12 support (#542) * django 5.0+ compatibility * remove unused tox.ini * update github actions, add support for django 5.0/5.1 and newer python releases * documentation * revert change to artifact upload * fix missing letter * restore and adjust tox.ini * Update docs/installation.rst --------- Co-authored-by: Asif Saif Uddin --- .github/workflows/workflow.yaml | 48 ++++++++++++++++++++---------- actstream/actions.py | 2 +- docs/changelog.rst | 4 ++- docs/installation.rst | 2 +- tox.ini | 52 +++++++++++++++++++-------------- 5 files changed, 68 insertions(+), 40 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index ee198e2b..9be9d5c4 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -30,31 +30,47 @@ jobs: strategy: fail-fast: false matrix: - python-version: + python: - 3.8 - 3.9 - "3.10" - - "3.11" - - "3.12" + - 3.11 + - 3.12 django: - 3.2 - 4.0 - 4.1 - 4.2 - 5.0 + - 5.1 database: - sqlite - mysql - postgres exclude: - - python-version: 3.8 - django: 5.0 - - python-version: 3.9 - django: 5.0 - - python-version: "3.11" + # django 3.2 + - python: 3.11 django: 3.2 - - python-version: "3.12" + - python: 3.12 django: 3.2 + # django 4.0 + - python: 3.11 + django: 4.0 + - python: 3.12 + django: 4.0 + # django 4.1 + - python: 3.12 + django: 4.1 + # django 5.0 + - python: 3.8 + django: 5.0 + - python: 3.9 + django: 5.0 + # django 5.1 + - python: 3.8 + django: 5.1 + - python: 3.9 + django: 5.1 # additional service containers to run services: @@ -98,10 +114,10 @@ jobs: - uses: actions/checkout@v4 # install python - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python }} # upgrade pip - name: Update pip @@ -109,7 +125,7 @@ jobs: # install environment specific dependencies - name: Install coverage - run: pip install coverage>=5.3 setuptools + run: pip install coverage>=7.6.0 setuptools - name: Install Django 3.2 if: matrix.django == 3.2 @@ -126,17 +142,19 @@ jobs: - name: Install Django 5.0 if: matrix.django == 5.0 run: pip install "Django>=5.0,<5.1" + - name: Install Django 5.1 + if: matrix.django == 5.1 + run: pip install "Django>=5.1,<5.2" - name: Install MySQL libs if: matrix.database == 'mysql' - run: pip install mysqlclient>=2.0.1 django-mysql>=3.9.0 + run: pip install mysqlclient>=2.2.4 django-mysql>=4.14.0 - name: Install postgres libs if: matrix.database == 'postgres' - run: pip install psycopg2-binary>=2.8.6 + run: pip install psycopg2-binary>=2.9.9 - name: Install Django ReST framework libraries run: pip install -U django-rest-framework rest-framework-generic-relations drf-spectacular - # install our package - name: Install package run: pip install -e . diff --git a/actstream/actions.py b/actstream/actions.py index 76f84512..4b2be684 100644 --- a/actstream/actions.py +++ b/actstream/actions.py @@ -115,7 +115,7 @@ def action_handler(verb, **kwargs): if hasattr(verb, '_proxy____args'): verb = verb._proxy____args[0] # _args is the new attribute in Django >= 5.0 - if hasattr(verb, '_args'): + elif hasattr(verb, '_args'): verb = verb._args[0] newaction = apps.get_model('actstream', 'action')( diff --git a/docs/changelog.rst b/docs/changelog.rst index 3d2cab4f..a7e0c0a6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -6,7 +6,9 @@ Changelog 2.0.1 ----- - - Adds support for Django 5.0 + - Added support for Django 5.0 and 5.1 + - Added support for Python 3.10, 3.11 and 3.12 + - Updated GitHub actions 2.0.0 ----- diff --git a/docs/installation.rst b/docs/installation.rst index 6b910be1..13f87618 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -60,7 +60,7 @@ Make sure to pick the version of Django and django-activity-stream that supports Python ****** -* **Python 3**: 3.6 to 3.12 +* **Python 3**: 3.8 to 3.12 * **PyPy**: 3 Django diff --git a/tox.ini b/tox.ini index b34ca7cc..2484599c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,15 @@ [tox] envlist = - py{37,38,39,310}-django32-{mysql,postgres,sqlite} - py{38,39,310}-django40-{mysql,postgres,sqlite} - py{38,39,310,311}-django41-{mysql,postgres,sqlite} - py{38,39,310,311,312}-django42-{mysql,postgres,sqlite} - py{310,311,312}-django50-{mysql,postgres,sqlite} + py{38,39,310}-django32-{mysql,postgres-psycopg2,sqlite} + py{38,39,310}-django40-{mysql,postgres-psycopg2,sqlite} + py{38,39,310,311}-django41-{mysql,postgres-psycopg2,sqlite} + py{38,39,310,311,312}-django42-{mysql,postgres-psycopg3,sqlite} + py{310,311,312}-django50-{mysql,postgres-psycopg3,sqlite} + py{310,311,312}-django51-{mysql,postgres-psycopg3,sqlite} toxworkdir=/tmp/.tox [testenv] -commands = python -m pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/ +commands = pytest -s --cov --cov-append actstream/ runtests/testapp runtests/testapp_nested/ deps = django-rest-framework @@ -18,35 +19,37 @@ deps = pytest pytest-cov pytest-django - setuptools coverage>=4.5.1 django32: Django>=3.2,<4.0 django40: Django>=4.0,<4.1 django41: Django>=4.1,<4.2 django42: Django>=4.2,<5.0 django50: Django>=5.0,<5.1 + django51: Django>=5.1,<5.2 mysql: mysqlclient>=2.0.0 mysql: django-mysql>=2.4.1 - postgres: psycopg2-binary>=2.8 + postgres-psycopg2: psycopg2-binary>=2.8 + postgres-psycopg3: psycopg-binary>=3.2 setenv = ; GITHUB_WORKFLOW=true ; Set this to force enable mysql/postgres dbs mysql: DATABASE_ENGINE=mysql - postgres: DATABASE_ENGINE=postgresql + postgres-psycopg2: DATABASE_ENGINE=postgresql + postgres-psycopg3: DATABASE_ENGINE=postgresql ; Pass this to force enable mysql/postgres dbs -passenv = - GITHUB_WORKFLOW - MYSQL_HOST - MYSQL_NAME - MYSQL_USER - MYSQL_PASSWORD - MYSQL_PORT - POSTGRES_HOST - POSTGRES_NAME - POSTGRES_PORT - POSTGRES_USER - POSTGRES_PASSWORD +passenv = + GITHUB_WORKFLOW + MYSQL_HOST + MYSQL_NAME + MYSQL_USER + MYSQL_PASSWORD + MYSQL_PORT + POSTGRES_HOST + POSTGRES_NAME + POSTGRES_PORT + POSTGRES_USER + POSTGRES_PASSWORD SQLITE_NAME usedevelop = True @@ -64,9 +67,14 @@ commands = [travis:env] DJANGO = + 5.1: django51 + 5.0: django50 + 4.2: django42 + 4.1: django41 4.0: django40 3.2: django32 DATABASE = mysql: mysql - postgresql: postgresql + postgres-psycopg2: postgresql + postgres-psycopg3: postgresql sqlite: sqlite