简体   繁体   中英

Can we replace find_packages with find_namespace_packages in python 3.3 onwards and get rid of the empty init.py files?

I have a distribution with multiple package and sub packages. There are many empty __init__.py files used to tell setuptools that the folders are packages.

In python 3.3 onwards, setuptools supports find_namespace_packages . So is it a good idea to get rid of the empty __init__.py files and replace the find_packages with find_namespace_packages?

There are three ways to namespace packages , each with its own pros and cons. It is true that find_namespace_packages is the recommended solution for Python3+ projects; though remember that this does not mean you omit all __init__.py files, you only remove the __init__.py in the namespace root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM