namespace-package

Packages in same namespace: can't import module in setup script

陌路散爱 提交于 2019-12-06 09:50:29
I'm curious about the following situation. Let's say I have two projects named project_alpha and project_bravo , both defining a top-level namespace package mymeta . The layout: project_alpha/ -> mymeta/ -> __init__.py -> project_alpha/ -> __init__.py -> version.py -> setup.py project_bravo/ -> mymeta/ -> __init__.py -> project_bravo/ -> __init__.py -> version.py -> setup.py Both mymeta/__init__.py s contain only the line __import__('pkg_resources').declare_namespace(__name__) (according to namespace section in setuptools docs ). Contents of both version.py s: __version_info__ = (0, 9, 9,

Namespace packages with a core part?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 02:43:01
This question follows up The way to make namespace packages in Python and How do I create a namespace package in Python? . Note PEP 420 , and the distribute docs , which state: You must NOT include any other code and data in a namespace package’s __init__.py . Even though it may appear to work during development, or when projects are installed as .egg files, it will not work when the projects are installed using “system” packaging tools – in such cases the __init__.py files will not be installed, let alone executed. This all seems to make it impossible to have a "main library" package with