On 7/19/20 10:25 PM, Tim Graham wrote:
> Another commenter remarked, "We had a similar issue with test discovery.
> One of our developers read an article that __init__.py files are not
> required on Python3 and started removing them. Everything seemingly
> worked but some tests were not discovered and did not run in CI (which
> made it difficult to spot). I think Django should not required them if
> technically possible or at least it should be made clear in the
> documentation (sorry if I overlooked it)."
> Supporting namespace packages without a real use case seems contrary to
> the consensus in this thread (which I see as not promoting implicit
> namespace packages). Based on that consensus, my inclination wouldn't be
> to try to make Django work with as few __init__.py files as possible.
> What do you think?
I agree. The situation of "One of our developers read an article that
__init__.py files are not required on Python3" is exactly the one we
should act against, as far as we can. This is a common misunderstanding
that we should try to clear up, not promote.
The person you quoted gives an example of why this is not purely
academical. Maybe it's debatable whether Python should behave
differently, but that's not something that Django can fix.
I am in favour of failing early and loudly here. IMHO Django should
ignore migration packages without an __init__.py file, maybe with a
warning, or maybe even with an error.