I've just finished upgrading Django REST framework to support 1.10, and it's given me some food for thought on things that can make Django upgrades painful.
Firstly, here's a couple of things that I needed to track down in order to upgrade that weren't obvious at first... * A bunch of test views started returning 404s. * None of the app templates were being found. * `user` was no longer being passed into template contexts. All of these were due to changes that have been part of the standard deprecation cycle, which is fair enough, however they weren't necessarily all that easy to debug. Figuring them out involves digging through the set of removed features <https://docs.djangoproject.com/en/dev/releases/1.10/#removed-features-1-10>, and trying to figure out which of those would result in the behavior change that's been seen. Aside: I think the `.urls = ...` -> `@override_settings(ROOT_URLCONF=...)` change to test cases is missing from those notes? I expected to have seen a deprecation warning when running the tests under 1.9, although wasn't exactly sure if and when those warnings would be displayed. Seeing the deprecation warnings under 1.9 would have made the upgrade far simpler, as I'd be warned about the changes I needed to make, rather than seeing a behavioral change and having to debug what might have caused it. Figuring out how to ensure that the tests properly displayed deprecation warnings (under py.test) wasn't all that easy either, eventually I got there with... python -Wd [...]/py.test tests/ -s (The behavior still isn't ideal then as each instance of warning is output once every time for each occurrence, rather than once and once only) The upshot of all this is that I believe many of our users are likely to be hitting problems with upgrades because they're not seeing deprecation warnings, and then get hit by a behavioral change that they weren't expecting to have to deal with, and end up having to debug the cause of. I'm wondering if we could do more to help our users here? For instance, a user is running under 1.9 and wants to upgrade to 1.10. Could we have a reliable and documented mechanism by which they'd first run the tests under 1.9, and have any Deprecation warnings treated as errors? If they're running 1.8, could we document how to run the tests so that any PendingDeprecation warnings are treated as errors? Could we collate instances of these warnings, rather than displaying them in an overly verbose fashion? python -Werror sort of achieves this, but doesn't differentiate between deprecation and pending deprecation. An example of the sort of thing we could do might be to have an environment variable `DJANGO_UPGRADE`, that if set to a version number, forces the relevant class of deprecation / pending deprecation warnings to be written to a log file or similar. I don't think that interface is quite right, but suggesting it as an example of how we might make our user's lives easier. Any other suggestions or thoughts in this area? Tom -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/dd7a2cda-12fd-42e4-8ecb-cfec60c1d69f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
