This repository contains samples for the various ways to create namespace packages in Python. For more details, see the documentation on namespace packages
This repo also contains testing tools to exercise installation scenarios for namespace packages.
To run the scenarios:
$ pip install -r requirements.txt
$ nox --report report.json
nox will execute all of the scenarios and report whether the namespace
packages are able to be imported successfully after installation. You can
use python report_to_table.py to transform the report into a
markdown-friendly table.
To see the status since the last time the scenarios were run open table.md1.
Please note:
pkg_resources method of namspacing is deprecated.
Whenever possible, developers are encouraged to migrate away from it.pkgutil method.python setup.py install. To prevent this, it is recommended that you set zip_safe=False in setup.py, as we do here. Please also note that distributing packages via egg files is considered deprecated.pip with build isolation and build-backend APIs.
This is triggered by the presence of a pyproject.toml file in each package source directory.
If your package does not have a pyproject.toml file,
pip might select a legacy (and deprecated) installation procedure, which can behave differently.It is difficult migrate away from deprecated pkg_resources namepaces in large projects.
Ideally, all packages sharing a namespace should coordinate and simultaneously drop __init__.py files to conform with PEP 420.
However, developers might be interested in carrying out a staggered migration plan and temporarily mix different namespacing techniques
to mitigate the migration effort and spread the work load in time.
Based on the results for the scenarios mixing pkg_resources and other namespace methods reported in
table.md and legacy_table.md,
we can see that (in principle) a staggered migration plan can be successful,
as long as the developers are willing to accept some limitations:
python setup.py install),Please note, however, that these are preliminary studies. Developers should carry out an independent investigation, and check for the specific use cases they are interested in supporting.
If you would like to know about deprecated installation methods (e.g. via
python setup.py install) or Python 2.7, please have a look at legacy_table.md. ↩
Python
100.0%
This repository contains samples for the various ways to create namespace packages in Python. For more details, see the documentation on namespace packages
This repo also contains testing tools to exercise installation scenarios for namespace packages.
To run the scenarios:
$ pip install -r requirements.txt
$ nox --report report.json
nox will execute all of the scenarios and report whether the namespace
packages are able to be imported successfully after installation. You can
use python report_to_table.py to transform the report into a
markdown-friendly table.
To see the status since the last time the scenarios were run open table.md1.
Please note:
pkg_resources method of namspacing is deprecated.
Whenever possible, developers are encouraged to migrate away from it.pkgutil method.python setup.py install. To prevent this, it is recommended that you set zip_safe=False in setup.py, as we do here. Please also note that distributing packages via egg files is considered deprecated.pip with build isolation and build-backend APIs.
This is triggered by the presence of a pyproject.toml file in each package source directory.
If your package does not have a pyproject.toml file,
pip might select a legacy (and deprecated) installation procedure, which can behave differently.It is difficult migrate away from deprecated pkg_resources namepaces in large projects.
Ideally, all packages sharing a namespace should coordinate and simultaneously drop __init__.py files to conform with PEP 420.
However, developers might be interested in carrying out a staggered migration plan and temporarily mix different namespacing techniques
to mitigate the migration effort and spread the work load in time.
Based on the results for the scenarios mixing pkg_resources and other namespace methods reported in
table.md and legacy_table.md,
we can see that (in principle) a staggered migration plan can be successful,
as long as the developers are willing to accept some limitations:
python setup.py install),Please note, however, that these are preliminary studies. Developers should carry out an independent investigation, and check for the specific use cases they are interested in supporting.
If you would like to know about deprecated installation methods (e.g. via
python setup.py install) or Python 2.7, please have a look at legacy_table.md. ↩
Python
100.0%