The goal of this repo is to test several hypotheses about namespace packages and their usage in real-life scenarios. Tests are focused on Python 3, but for completeness we run them in Python 2, too.
Different approaches for creating namespace packages are covered in PyPA's Packaging namespace packages document, as well in PEP-420. Basic examples are given in pypa/sample-namespace-packages GitHub repository.
Here we're extending these samples (for native and pkgutil approaches) to
test the following claims:
- no autocomplete on second-level packages
- all stem
__init__.pymust be empty - uninstalls break the namespace
- developer installs might not work effectively
$ pip install -r requirements.txt
$ nox
Moved to raw.md.
rootis an empty shared namespace forroot.aandroot.b(split in two packages), or forroot.aandroot.b.cpkgutilapproach works for all install type variants, in all Python versions- development and regular install work equally well
- in Python 2, for regular pip install method, uninstall of one package breaks the import of the other
- (fully) works in Python 3 (all test cases pass)
- developer install works in Python 2, but regular uninstall doesn't
root.bis not empty, yet we try to overlap it withroot.b.c- (fully) works only in Python 3 for only regular pip installs, but both approaches
- non-empty
root.bis overlapped withroot.b.c(as in previous case), but then also withroot.b.d(implemented in module filed.py) androot.b.e(implemented ine/__init__.py) - (fully) works only in Python 3 for only regular pip installs and only
nativeapproach
-
For full Python 2 and 3 compatibility, all stem
__init__.pymust be empty. -
Developer installs work.
-
Uninstall works in Python 3 and mostly in Python 2.
-
To have autocomplete on second-level packages, clashing namespaces would have to be used, and those work only for native namespace packages in Python 3.