browniebroke / django-codemod

A tool to automatically fix Django deprecations.
https://django-codemod.readthedocs.io
MIT License
181 stars 17 forks source link

Django 4 django.dispatch.Signal unexpected keyword argument providing_args #502

Open jayvdb opened 2 years ago

jayvdb commented 2 years ago

SUSE Tumbleweed has updated django to 4.0, and while fixing django packages I've noticed a lot of packages are failing with this. e.g. https://build.opensuse.org/package/show/home:jayvdb:branches:devel:languages:python:django/python-django-avatar

https://docs.djangoproject.com/en/dev/releases/4.0/

See Features deprecated in 3.1 for details on these changes, including how to remove usage of these features. .. The providing_args argument for django.dispatch.Signal is removed.

Deprecation timeline

jayvdb commented 2 years ago

More examples:

browniebroke commented 2 years ago

This is handled by django-upgrade, see https://github.com/adamchainz/django-upgrade#signal, have you tried it? Django Upgrade took a different approach and is much faster as a result. I need to update the readme here to point to that project. Is there a reason why you cannot use it?

jayvdb commented 2 years ago

Havent seen that one before. Good to know, but not going to be very reliable as it isn't a CST. Of those, it didn't work on

browniebroke commented 2 years ago

not going to be very reliable as it isn't a CST

AFAIK, a lot of tools aren't using CST and I rely on them everyday, they are extremely reliable: black, pyupgrade. Django-upgrade takes a similar approach and it worked fine on a project I tried it on.

I'm not familiar with build.opensuse.org, I'm not sure what I'm supposed to see in them. Can we see the logs of the problem somewhere? Can you make a summary here of what's wrong?

jayvdb commented 2 years ago

Yea, django-upgrade worked on most of the projects I mentioned earlier.

I think you need to create an account in order to see the build logs on OBS. The logs are under a clickable red link "failed". The .spec files in each project show where I have added django-upgrade, and the logs show it doesn't work for two of them.

If you don't want to create an OBS account, the same commands can be run on the github repos for each project.

I've done a PR for django-mailman3; the rest had other additional Django 4 problems, often the middleware get_response problem.