Is there a tool/helper that checks a code base against deprecated features?

Hi Everyone,

Apologies if this question belongs to Django Internals instead of here. :slight_smile:

With the release of Django 4.0, an interesting discussion happened at work today. Given a list of deprecated features such as this one, is there a tool (or Django helper) out in the wild that would check a given repository with Django code against the deprecated list and output everything that needs changing or reviewing in the repository?

A quick search on Google and here on the forum did not reveal any obvious results :frowning: therefore, I decided to check if anyone here has come across with such a thing.

Kind regards,
Adriano

Nope, you’ve reached the right spot.

See How to upgrade Django to a newer version | Django documentation | Django

Note that using the -Wa will work with all management commands, not just test. You can use it with runserver or shell, or with any custom commands you’ve written.

Ken is right that -Wa is the easiest way to see all warnings.

You can also activate Python’s development mode locally, all the time, to see all warnings: Python Development Mode — Python 3.10.1 documentation

Generally if your project works on your Django version without warnings, you’ll work on the next version, minus the few niche backwards incompatibilty changes.

Also check out my tool django-upgrade which can rewrite some old code patterns: GitHub - adamchainz/django-upgrade: Automatically upgrade your Django projects.

Hi Ken and Adam!

First, @KenWhitesell, thank you so much for yet another quick reply. That will be very helpful :smiley:

@adamchainz I had a quick look at your tool and it looks very interesting. I will try it when I have some free time later this week. If I have any insightful feedback, I will send it your way.

Thanks again for the help, guys :smiley: