[Django] #36523: Implement helper method to find module path of value

7 views
Skip to first unread message

Django

unread,
Jul 24, 2025, 11:28:01 AMJul 24
to django-...@googlegroups.com
#36523: Implement helper method to find module path of value
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Type:
| Cleanup/optimization
Status: new | Component:
| Uncategorized
Version: | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Finding the module path for where a given class or function is defined is
functionality used in a few places across the Django codebase. Whilst in
the majority of cases, `f"{val.__module__}.{val.__qualname__}"` is enough,
there are some cases it's not.

As part of #35859, a few more cases of this pattern are being added to the
codebase. I think we're now at the [point
https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)] where
it makes sense to extract this out to a helper function somewhere in
`django.utils`. The implementation in
`django.migrations.serializer.TypeSerializer` seems to be the most robust,
however will want some more thorough testing based on different input
types.
--
Ticket URL: <https://code.djangoproject.com/ticket/36523>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 24, 2025, 11:28:31 AMJul 24
to django-...@googlegroups.com
#36523: Implement helper method to find module path of value
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jake Howard):

Probably worth holding off on this ticket until #35859 is merged, so all
uses can be covered.
--
Ticket URL: <https://code.djangoproject.com/ticket/36523#comment:1>

Django

unread,
Jul 24, 2025, 1:05:41 PMJul 24
to django-...@googlegroups.com
#36523: Implement helper method to find module path of value
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* component: Uncategorized => Utilities
* easy: 1 => 0
* stage: Unreviewed => Someday/Maybe
* version: => dev

Comment:

Thank you Jake for creating the ticket. Could please enumerate the
locations of where this functionality is found?
--
Ticket URL: <https://code.djangoproject.com/ticket/36523#comment:2>

Django

unread,
Aug 8, 2025, 3:45:53 AMAug 8
to django-...@googlegroups.com
#36523: Implement helper method to find module path of value
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner:
Type: | shrutisachan08
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by shrutisachan08):

* owner: (none) => shrutisachan08
* status: new => assigned

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

Django

unread,
Aug 22, 2025, 7:49:52 AM (14 days ago) Aug 22
to django-...@googlegroups.com
#36523: Implement helper method to find module path of value
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner:
Type: | shrutisachan08
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jake Howard):

* cc: Jake Howard (added)

Comment:

That sounds like the right approach to me - thanks for picking this up!
--
Ticket URL: <https://code.djangoproject.com/ticket/36523#comment:4>
Reply all
Reply to author
Forward
0 new messages