From 95c6a481086a5f0a0129d02a1e6400e833817b6f Mon Sep 17 00:00:00 2001 From: Hameed Gifford Date: Sun, 19 Jan 2020 01:18:25 -0500 Subject: [PATCH 1/3] Test python 3.8 and Django 3.0 Aligns the doc specs to match tested versions --- .travis.yml | 17 ++++++----------- README.rst | 4 ++-- notifications/__init__.py | 13 +++++++++++++ notifications/base/models.py | 5 +---- notifications/migrations/0001_initial.py | 2 -- .../migrations/0002_auto_20150224_1134.py | 2 -- .../migrations/0003_notification_data.py | 2 -- .../migrations/0004_auto_20150826_1508.py | 2 -- .../migrations/0005_auto_20160504_1520.py | 2 -- setup.py | 18 ++++++++++-------- tox.ini | 15 +++++++-------- 11 files changed, 39 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92f1f96..ed8f12b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,15 @@ language: python python: - - "2.7" - - "3.4" - "3.5" - "3.6" + - "3.7" + - "3.8" env: - - DJANGO=1.7 - - DJANGO=1.8 - - DJANGO=1.9 - - DJANGO=1.10 - DJANGO=1.11 - DJANGO=2.0 + - DJANGO=2.1 + - DJANGO=2.2 + - DJANGO=3.0 install: # command to install dependencies - "pip install coveralls" @@ -22,12 +21,8 @@ script: - coverage run --branch --source=notifications manage.py test matrix: exclude: - - python: "2.7" - env: DJANGO=2.0 - python: "3.5" - env: DJANGO=1.7 - - python: "3.6" - env: DJANGO=1.7 + env: DJANGO=3.0 after_success: diff --git a/README.rst b/README.rst index 8e81d91..0f4844c 100644 --- a/README.rst +++ b/README.rst @@ -28,8 +28,8 @@ Nomenclature of this specification is based on the Activity Streams Spec: `= (3,): + from django import utils + import six + utils.six = six + + +_patch_jsonfield_six() +del _patch_jsonfield_six diff --git a/notifications/base/models.py b/notifications/base/models.py index 3fae25d..c563857 100644 --- a/notifications/base/models.py +++ b/notifications/base/models.py @@ -11,8 +11,6 @@ from django.core.exceptions import ImproperlyConfigured from django.db import models from django.db.models.query import QuerySet from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible -from django.utils.six import text_type from jsonfield.fields import JSONField from model_utils import Choices @@ -139,7 +137,6 @@ class NotificationQuerySet(models.query.QuerySet): return qset.update(emailed=True) -@python_2_unicode_compatible class AbstractNotification(models.Model): """ Action model describing the actor acting out a verb (on an optional @@ -290,7 +287,7 @@ def notify_handler(verb, **kwargs): recipient=recipient, actor_content_type=ContentType.objects.get_for_model(actor), actor_object_id=actor.pk, - verb=text_type(verb), + verb=str(verb), public=public, description=description, timestamp=timestamp, diff --git a/notifications/migrations/0001_initial.py b/notifications/migrations/0001_initial.py index 4423ccd..03f0c75 100644 --- a/notifications/migrations/0001_initial.py +++ b/notifications/migrations/0001_initial.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models, migrations import django.utils.timezone from django.conf import settings diff --git a/notifications/migrations/0002_auto_20150224_1134.py b/notifications/migrations/0002_auto_20150224_1134.py index 5e34689..51273de 100644 --- a/notifications/migrations/0002_auto_20150224_1134.py +++ b/notifications/migrations/0002_auto_20150224_1134.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models, migrations diff --git a/notifications/migrations/0003_notification_data.py b/notifications/migrations/0003_notification_data.py index 871e0b3..a7840a2 100644 --- a/notifications/migrations/0003_notification_data.py +++ b/notifications/migrations/0003_notification_data.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models, migrations import jsonfield.fields diff --git a/notifications/migrations/0004_auto_20150826_1508.py b/notifications/migrations/0004_auto_20150826_1508.py index a109dc1..656b420 100644 --- a/notifications/migrations/0004_auto_20150826_1508.py +++ b/notifications/migrations/0004_auto_20150826_1508.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import models, migrations from django.utils import timezone diff --git a/notifications/migrations/0005_auto_20160504_1520.py b/notifications/migrations/0005_auto_20160504_1520.py index 223cb1b..dd1b8c1 100644 --- a/notifications/migrations/0005_auto_20160504_1520.py +++ b/notifications/migrations/0005_auto_20160504_1520.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-05-04 15:20 -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/setup.py b/setup.py index 142b7f9..663d94b 100755 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ setup( 'django>=1.7', 'django-model-utils>=2.0.3', 'jsonfield>=1.0.3', + 'six', # for jsonfield on django 3.0 until it drops py2 compat 'pytz', 'swapper' ], @@ -55,18 +56,19 @@ setup( 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Framework :: Django', - 'Framework :: Django :: 1.10', - 'Framework :: Django :: 1.9', - 'Framework :: Django :: 1.8', - 'Framework :: Django :: 1.7', + 'Framework :: Django :: 1.11', + 'Framework :: Django :: 2.0', + 'Framework :: Django :: 2.1', + 'Framework :: Django :: 2.2', + 'Framework :: Django :: 3.0', # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Utilities' ], keywords='django notifications github action event stream', diff --git a/tox.ini b/tox.ini index 2333c66..e7525f8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,17 @@ # -- FILE: tox.ini [tox] envlist = - py{27,33,34}-django17 - py{27,33,34,35,36}-django{18,19,110,111} - py{34,35,36}-django200 + py{35,36,37,38}-django{111,20,21,22} + py{36,37,38}-django30 [testenv] commands = coverage run --branch --source=notifications manage.py test deps = coverage - django17: Django>=1.7,<1.8 - django18: Django>=1.8,<1.9 - django19: Django>=1.9,<1.10 - django110: Django>=1.10,<1.11 django111: Django>=1.11,<2.0 - django200: Django>=2.0,<3.0 + django20: Django>=2.0,<2.1 + django21: Django>=2.1,<2.2 + django22: Django>=2.2,<2.3 + django30: Django>=3.0,<3.1 + django30: six From 80830d15598a5a9143a4c82adb21b1efab78a625 Mon Sep 17 00:00:00 2001 From: Hameed Gifford Date: Fri, 24 Jan 2020 11:17:16 -0500 Subject: [PATCH 2/3] Only support mainstream Django versions --- .travis.yml | 3 --- README.rst | 2 +- setup.py | 11 ++++------- tox.ini | 5 +---- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed8f12b..a57a1fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,6 @@ python: - "3.7" - "3.8" env: - - DJANGO=1.11 - - DJANGO=2.0 - - DJANGO=2.1 - DJANGO=2.2 - DJANGO=3.0 install: diff --git a/README.rst b/README.rst index 0f4844c..5fb3949 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ Requirements ============ - Python 3.5, 3.6, 3.7, 3.8 -- Django 1.11, 2.0, 2.1, 2.2, 3.0 +- Django 2.2, 3.0 Installation ============ diff --git a/setup.py b/setup.py index 663d94b..acc7c4c 100755 --- a/setup.py +++ b/setup.py @@ -26,16 +26,16 @@ setup( author_email='yang@yangyubo.com', url='http://github.com/django-notifications/django-notifications', install_requires=[ - 'django>=1.7', - 'django-model-utils>=2.0.3', + 'django>=2.2', + 'django-model-utils>=3.1.0', 'jsonfield>=1.0.3', 'six', # for jsonfield on django 3.0 until it drops py2 compat 'pytz', 'swapper' ], test_requires=[ - 'django>=1.7', - 'django-model-utils>=2.0.3', + 'django>=2.2', + 'django-model-utils>=3.1.0', 'jsonfield>=1.0.3', 'pytz' ], @@ -56,9 +56,6 @@ setup( 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Framework :: Django', - 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', - 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', # Specify the Python versions you support here. In particular, ensure diff --git a/tox.ini b/tox.ini index e7525f8..c1e50e1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ # -- FILE: tox.ini [tox] envlist = - py{35,36,37,38}-django{111,20,21,22} + py{35,36,37,38}-django22 py{36,37,38}-django30 [testenv] @@ -9,9 +9,6 @@ commands = coverage run --branch --source=notifications manage.py test deps = coverage - django111: Django>=1.11,<2.0 - django20: Django>=2.0,<2.1 - django21: Django>=2.1,<2.2 django22: Django>=2.2,<2.3 django30: Django>=3.0,<3.1 django30: six From 9596b599ad234830b420daa8bd895c549dcc64e5 Mon Sep 17 00:00:00 2001 From: Hameed Gifford Date: Thu, 13 Feb 2020 15:13:56 -0500 Subject: [PATCH 3/3] JSONField has updated, the patch is no longer needed. Horray! --- notifications/__init__.py | 13 ------------- setup.py | 5 ++--- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/notifications/__init__.py b/notifications/__init__.py index e8d3f11..6a254b8 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -11,16 +11,3 @@ __version__ = '1.4.0' default_app_config = 'notifications.apps.Config' # pylint: disable=invalid-name - - -# patch jsonfield expectations until they actually update -def _patch_jsonfield_six(): - import django - if django.VERSION >= (3,): - from django import utils - import six - utils.six = six - - -_patch_jsonfield_six() -del _patch_jsonfield_six diff --git a/setup.py b/setup.py index acc7c4c..9f4e29b 100755 --- a/setup.py +++ b/setup.py @@ -28,15 +28,14 @@ setup( install_requires=[ 'django>=2.2', 'django-model-utils>=3.1.0', - 'jsonfield>=1.0.3', - 'six', # for jsonfield on django 3.0 until it drops py2 compat + 'jsonfield>=2.1.0', 'pytz', 'swapper' ], test_requires=[ 'django>=2.2', 'django-model-utils>=3.1.0', - 'jsonfield>=1.0.3', + 'jsonfield>=2.1.0', 'pytz' ], packages=[