Reputation: 2953
Does setuptools' find_packages
still require that packages have an __init__.py
file inside?
The documentation says
Packages are only recognized if they include an
__init__.py
file.
But I read that __init__.py
files are not required anymore to mark a directory as a python package.
Upvotes: 1
Views: 1842
Reputation: 22305
Update
Looking back, the original answer is misguided.
Package initializers (the __init__.py
files) should always be there. Because of some implementation details, it is true that it might work without, but it is not something that was strictly intended and not something that should be relied on.
Some details:
Original answer
In recent version of Python the package initializers (the __init__.py
files) are not strictly necessary, meaning that such packages can be imported and so on.
But setuptools is not Python, so to say. And in particular find_packages
still bases its lookup on the presence of such files. On the other hand, setuptools also offers the alternative find_namespace_packages
function, that is able to find packages that do not contain a package initializer.
Upvotes: 7