Skip to content

Commit

Permalink
Add Django 5.0/5.1 and Python 3.10/3.11/3.12 support (#542)
Browse files Browse the repository at this point in the history
* 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 <auvipy@gmail.com>
  • Loading branch information
lociii and auvipy committed Sep 7, 2024
1 parent 4f2101d commit 27a62e6
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 40 deletions.
48 changes: 33 additions & 15 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -98,18 +114,18 @@ 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
run: python -m pip install --upgrade pip

# 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
Expand All @@ -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 .
Expand Down
2 changes: 1 addition & 1 deletion actstream/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')(
Expand Down
4 changes: 3 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 30 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 27a62e6

Please sign in to comment.