PEP420 makes __init__.py files optional: https://docs.python.org/3/whatsnew/3.3.html#pep-420-implicit-namespace-packages
Though it seems without them, pkgutil.walk_packages does not function as desired: https://docs.python.org/3/library/pkgutil.html#pkgutil.walk_packages
Consider the following example:
```
$ tree foo
foo
├── bar
│ ├── baz.py
│ └── __init__.py
├── __init__.py
└── womp.py
```
And a test script
# test.py
```
import pkgutil
import foo
for _, mod, _ in pkgutil.walk_packages(foo.__path__, foo.__name__ + '.'):
print(mod)
```
In both python2 and python3 I get the following output:
```
$ python2.7 test.py
foo.bar
foo.bar.baz
foo.womp
$ python3.5 test.py
foo.bar
foo.bar.baz
foo.womp
```
Removing the __init__.py files and only using python3, I get this:
```
$ find -name '__init__.*' -delete
$ python3.5 test.py
foo.bar
```
The modules are definitely importable:
```
$ python3.5 -c 'import foo.bar.baz'
$
```
Originally asked as a question on stackoverflow: http://stackoverflow.com/questions/41203765/init-py-required-for-pkgutil-walk-packages-in-python3 |