Django developers,

The migration loader currently loads migrations only from apps whose 
migrations package has a __file__ 
<https://docs.python.org/3/reference/import.html#__file__> attribute. The 
reason for this check, given both in the source code comments 
<https://github.com/django/django/blob/2a76f4313423a3b91caade4fce71790630ef9152/django/db/migrations/loader.py#L91-L95>
 
and in discussions among maintainers 
<https://groups.google.com/g/django-developers/c/GVHMH2ciAnk/m/vbIPbZuSBQAJ>, 
is to discourage the use of PEP-420 
<http://www.python.org/dev/peps/pep-0420/> namespace packages.

Without affecting that behavior, I propose to permit migrations run from 
Python environments that do not provide even *regular* packages with a 
__file__ <https://docs.python.org/3/reference/import.html#__file__> 
attribute. (This falls under the general umbrella of #30950 
<https://code.djangoproject.com/ticket/30950>, which describes these 
environments a little.) The required change is just a few lines.

If this proposal is something you would consider, I will submit a Trac 
ticket laying out further details, including citations to Python 
documentation that justifies my approach. I will simultaneously submit a PR 
with the change and a test. Documentation changes are not likely necessary, 
but I can add some if desired.

I would love for this feature to land in 3.2 before the feature-freeze 
date, and can do all the work for it if a Django committer can review and 
merge the PR.

Best,
William Schwartz

-- 
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 django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1c2cb975-0f78-4ef9-a025-303dcb17a5aen%40googlegroups.com.

Reply via email to