[Django] #32528: Replace django.utils.topological_sort with graphlib.

29 views
Skip to first unread message

Django

unread,
Mar 9, 2021, 4:56:16 AM3/9/21
to django-...@googlegroups.com
#32528: Replace django.utils.topological_sort with graphlib.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Keywords: backport, graphlib,
Triage Stage: | toposort, topological sort
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In Python 3.9 we have a new standard library module,
[https://docs.python.org/3/library/graphlib.html 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32528>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 9, 2021, 4:59:05 AM3/9/21
to django-...@googlegroups.com
#32528: Replace django.utils.topological_sort with graphlib.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Resolution:

Keywords: backport, graphlib, | Triage Stage:
toposort, topological sort | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/14102 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/32528#comment:1>

Django

unread,
Mar 9, 2021, 5:40:36 AM3/9/21
to django-...@googlegroups.com
#32528: Replace django.utils.topological_sort with graphlib.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Resolution:

Keywords: backport, graphlib, | Triage Stage:
toposort, topological sort | Someday/Maybe
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Unreviewed => Someday/Maybe


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32528#comment:2>

Django

unread,
Mar 9, 2021, 6:06:13 AM3/9/21
to django-...@googlegroups.com
#32528: Replace django.utils.topological_sort with graphlib.
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Resolution:

Keywords: backport, graphlib, | Triage Stage:
toposort, topological sort | Someday/Maybe
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nick Pope):

That's fine. Was really just putting this on the radar.

--
Ticket URL: <https://code.djangoproject.com/ticket/32528#comment:3>

Reply all
Reply to author
Forward
0 new messages