#32528 closed Cleanup/optimization (fixed)
Replace django.utils.topological_sort with graphlib.
Reported by: | Nick Pope | Owned by: | Nick Pope |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | backport, graphlib, toposort, topological sort |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In Python 3.9 we have a new standard library module, graphlib, that includes a topological sort implementation.
Let's use this instead of our custom implementation in django.utils.topological_sort
.
This will require a backport for Python 3.8, the minimum supported version for Django 4.0, but when support for Python 3.8 is removed we can simply drop the backport. When using Python 3.9+ we'll just use the module direct from the standard library.
Change History (9)
comment:1 by , 4 years ago
Has patch: | set |
---|
comment:2 by , 4 years ago
Triage Stage: | Unreviewed → Someday/Maybe |
---|
Thanks for this report, however but I don't think we should backport this feature from Python or use it now. It would be hard to keep graphlib
implementation and our backport in sync, it's not worth the maintenance burden. We can reconsider this ticket when Python 3.9 becomes the minimal Python supported by Django.
comment:4 by , 2 years ago
Triage Stage: | Someday/Maybe → Accepted |
---|
Whoop! The time has come. New PR.
comment:5 by , 2 years ago
Description: | modified (diff) |
---|
comment:6 by , 2 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
PR