[07/11] Add support for Django 2.0

Message ID 20180624195557.19909-7-stephen@that.guru
State Accepted
Headers show
Series
  • [01/11] REST: Check.user is not read-only
Related show

Commit Message

Stephen Finucane June 24, 2018, 7:55 p.m.
Nothing too complicated here except for the addition of a new compat
wrapper, which will be removed again shortly. According to the Django
release notes, Django should function with Python 3.4. However, it was
not possible to get this functioning due to the below error:

  Traceback (most recent call last):
    File ".../patchwork/manage.py", line 11, in <module>
    ...
    File ".../django/db/models/fields/related.py", line 313, in contribute_to_class
      'app_label': cls._meta.app_label.lower(),
  TypeError: unsupported operand type(s) for %: 'bytes' and 'dict'

This does not appear to be an issue with Patchwork but the exact root
cause has not been identified. As a result, only Python 3.5 and 3.6 are
marked as supported for this Django version.

As this is the first Python 3-only dependency we have, we need to start
making use of the 'python_version' environment marker.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 releasenotes/notes/django-2-0-support-807980866ca16b77.yaml | 5 +++++
 requirements-dev.txt                                        | 3 ++-
 requirements-prod.txt                                       | 3 ++-
 tox.ini                                                     | 5 ++++-
 4 files changed, 13 insertions(+), 3 deletions(-)
 create mode 100644 releasenotes/notes/django-2-0-support-807980866ca16b77.yaml

Comments

Daniel Axtens July 12, 2018, 5:56 a.m. | #1
Stephen Finucane <stephen@that.guru> writes:

Yay! I'll give these a spin - hopefully in the next few days (but no
promises). However, if you're confident in your testing I'm pretty happy
to see them go in before that.

My one concern is the tox warning supression one, but it's possible I'd
be happier with it once I've tested it. I just worry about missing a
deprecation warning and not finding out until the feature has been removed...

Regards,
Daniel

> Nothing too complicated here except for the addition of a new compat
> wrapper, which will be removed again shortly. According to the Django
> release notes, Django should function with Python 3.4. However, it was
> not possible to get this functioning due to the below error:
>
>   Traceback (most recent call last):
>     File ".../patchwork/manage.py", line 11, in <module>
>     ...
>     File ".../django/db/models/fields/related.py", line 313, in contribute_to_class
>       'app_label': cls._meta.app_label.lower(),
>   TypeError: unsupported operand type(s) for %: 'bytes' and 'dict'
>
> This does not appear to be an issue with Patchwork but the exact root
> cause has not been identified. As a result, only Python 3.5 and 3.6 are
> marked as supported for this Django version.
>
> As this is the first Python 3-only dependency we have, we need to start
> making use of the 'python_version' environment marker.
>
> Signed-off-by: Stephen Finucane <stephen@that.guru>
> ---
>  releasenotes/notes/django-2-0-support-807980866ca16b77.yaml | 5 +++++
>  requirements-dev.txt                                        | 3 ++-
>  requirements-prod.txt                                       | 3 ++-
>  tox.ini                                                     | 5 ++++-
>  4 files changed, 13 insertions(+), 3 deletions(-)
>  create mode 100644 releasenotes/notes/django-2-0-support-807980866ca16b77.yaml
>
> diff --git a/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml b/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml
> new file mode 100644
> index 00000000..5c206739
> --- /dev/null
> +++ b/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml
> @@ -0,0 +1,5 @@
> +---
> +features:
> +  - |
> +    `Django 2.0 <https://docs.djangoproject.com/en/2.0/releases/2.0/>`_ is now
> +    supported.
> diff --git a/requirements-dev.txt b/requirements-dev.txt
> index 8bad8f07..f4ad751a 100644
> --- a/requirements-dev.txt
> +++ b/requirements-dev.txt
> @@ -1,4 +1,5 @@
> -Django>=1.11,<2.0
> +Django>=1.11,<2.1; python_version >= '3.4'
> +Django>=1.11,<2.0; python_version < '3.0'
>  djangorestframework>=3.4,<3.9
>  django-filter>=1.0,<1.2
>  -r requirements-test.txt
> diff --git a/requirements-prod.txt b/requirements-prod.txt
> index c30688cc..e7a75354 100644
> --- a/requirements-prod.txt
> +++ b/requirements-prod.txt
> @@ -1,4 +1,5 @@
> -Django>=1.11,<2.0
> +Django>=1.11,<2.1; python_version >= '3.4'
> +Django>=1.11,<2.0; python_version < '3.0'
>  djangorestframework>=3.4,<3.9
>  django-filter>=1.0,<1.2
>  psycopg2>=2.7,<2.8
> diff --git a/tox.ini b/tox.ini
> index 5f3d7e72..4eef4c44 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -1,6 +1,6 @@
>  [tox]
>  minversion = 2.0
> -envlist = pep8,docs,py{27,34,35,36}-django111
> +envlist = pep8,docs,py{27,34}-django111,py{35,36}-django{111,20}
>  skipsdist = True
>  
>  [testenv]
> @@ -9,6 +9,9 @@ deps =
>      django111: django>=1.11,<2.0
>      django111: djangorestframework>=3.6,<3.9
>      django111: django-filter>=1.0,<1.2
> +    django20: django>=2.0,<2.1
> +    django20: djangorestframework>=3.7,<3.9
> +    django20: django-filter>=1.1,<1.2
>  setenv =
>      DJANGO_SETTINGS_MODULE = patchwork.settings.dev
>      PYTHONDONTWRITEBYTECODE = 1
> -- 
> 2.17.1
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork

Patch

diff --git a/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml b/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml
new file mode 100644
index 00000000..5c206739
--- /dev/null
+++ b/releasenotes/notes/django-2-0-support-807980866ca16b77.yaml
@@ -0,0 +1,5 @@ 
+---
+features:
+  - |
+    `Django 2.0 <https://docs.djangoproject.com/en/2.0/releases/2.0/>`_ is now
+    supported.
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 8bad8f07..f4ad751a 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,4 +1,5 @@ 
-Django>=1.11,<2.0
+Django>=1.11,<2.1; python_version >= '3.4'
+Django>=1.11,<2.0; python_version < '3.0'
 djangorestframework>=3.4,<3.9
 django-filter>=1.0,<1.2
 -r requirements-test.txt
diff --git a/requirements-prod.txt b/requirements-prod.txt
index c30688cc..e7a75354 100644
--- a/requirements-prod.txt
+++ b/requirements-prod.txt
@@ -1,4 +1,5 @@ 
-Django>=1.11,<2.0
+Django>=1.11,<2.1; python_version >= '3.4'
+Django>=1.11,<2.0; python_version < '3.0'
 djangorestframework>=3.4,<3.9
 django-filter>=1.0,<1.2
 psycopg2>=2.7,<2.8
diff --git a/tox.ini b/tox.ini
index 5f3d7e72..4eef4c44 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@ 
 [tox]
 minversion = 2.0
-envlist = pep8,docs,py{27,34,35,36}-django111
+envlist = pep8,docs,py{27,34}-django111,py{35,36}-django{111,20}
 skipsdist = True
 
 [testenv]
@@ -9,6 +9,9 @@  deps =
     django111: django>=1.11,<2.0
     django111: djangorestframework>=3.6,<3.9
     django111: django-filter>=1.0,<1.2
+    django20: django>=2.0,<2.1
+    django20: djangorestframework>=3.7,<3.9
+    django20: django-filter>=1.1,<1.2
 setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
     PYTHONDONTWRITEBYTECODE = 1