pakal / django-compat-patcher

A system to improve compatibility between different Django versions, and make upgrading dependencies less painful.
MIT License
13 stars 2 forks source link

Django 2.1 #2

Closed jayvdb closed 5 years ago

jayvdb commented 5 years ago

I am experiencing this failure on Django 2.2, but I believe it first occurs in Django 2.1

  File "/home/abuild/rpmbuild/BUILD/django-compat-patcher-0.4/tests/test_project/urls.py", line 10, in <module>
    url(r'^my_view/', "test_project.views.my_view"),
  File "/usr/lib/python3.7/site-packages/django/conf/urls/__init__.py", line 13, in url
    return re_path(regex, view, kwargs, name)
  File "/usr/lib/python3.7/site-packages/django/urls/conf.py", line 73, in _path
    raise TypeError('view must be a callable or a list/tuple in the case of include().')
TypeError: view must be a callable or a list/tuple in the case of include().

I have built this for openSUSE , but only enabled Python 2/Django 1.11 as the Python 3 builds need both Django 2.1 and 2.2 support.

https://build.opensuse.org/package/show/home:jayvdb:django/python-django-compat-patcher

See also upstream issue at https://github.com/arteria/django-compat/issues/66

pakal commented 5 years ago

Thanks for the input, DCP indeed lacks django 2+ support.

I'm kinda stuck for now since my big test project for DCP is python2-only, and hence can't run django2+.

But I'll have a look asap at upgrading DCP support for Django 2+ even only with minimal testing.

pakal commented 5 years ago

I've updated DCP, along with my big test project, to support up to Django2.2.1

See https://pypi.org/project/django-compat-patcher/0.5/

jayvdb commented 5 years ago

Works very nicely. My .spec is much nicer now, and ready to submit to openSUSE django collection.

Note there isnt a CHANGELOG entry for 0.5.

Also setup.py is missing tests_require and test_suite and other niceties. It would be nice if the license=<url> was license=MIT as most tools want that field to contain a SPDX short label. I can submit a PR to tidy this bit up, if you would prefer that.

pakal commented 5 years ago

I'd be quite interested by a PR on setup.py niceties indeed, thanks, I have little experience in python packaging :) Then I'll release a 5.1 with your PR and my updates to the changelog.

jayvdb commented 5 years ago

Sounds like a good plan.

Any chance you can fix https://github.com/pakal/django-compat-patcher/issues/3 ?

If so, I'll add green CI also.

pakal commented 5 years ago

Ok, I'm looking at it asap.

pakal commented 5 years ago

I've fixed tests, updated changelog, normalized fixer names, and made tox go through "setup.py test".

Could you please review the new setup.py, since making it work with pytest was not straighforward at all ?

CI should work with latest 0.6

jayvdb commented 5 years ago

0.6 is good enough for my openSUSE packaging, however there are a few minor additions needed for Travis CI and better packaging in the future. PR on the way..

pakal commented 5 years ago

Thanks for the PR, I'll have an additional look asap at how the patcher behaves when django-contrib-comments isn't installed, since it's now an "extra". (leaving ticket open as a reminder)

jayvdb commented 5 years ago

A good idea. A way to test this is to have a 'nocomments' factor in tox which doesn't install django-contrib-comments. I expect the tests in the current test project will fail, but fail in a sort-of sensible manner. A second test project which doesnt use comments would be needed to properly test how the patcher behaves without django-contrib-comments installed.

pakal commented 5 years ago

Alright, I've updated tox and fixer tests to check that it well returns a meaningful error when importing a missing "module alias" liek django.contrib.comments ; it works fine.

Thansk a lot for your contributions !