Reputation: 516
Background:
I'm working with namespace packages in 2 different versions of python.
When I build the package in 2.7.14 using pkgutils style ns packaging, I can install and the directory structure is rolled out how I want it to.
When I build the package in 3.6.4, the package installs, but the directory structure is not created as expected.
Setup:
I have 2 virtual environments.
In the working one, I'm using the 2.7.14 compatible pkgutils namespace package functionality. I'm using virtualenv for this virtual environment to confirm installation, and it installs as I wish. The directory structure shows up in my venv/Lib/site-packages as expected, such that venv/Lib/site-packages/tools/sub_a exists.
In the non-working one, I'm using venv and implicit namespace packaging per PEP420
Here is my 3.6.4 package directory structure:
tools
-sub_a
-__init__.py
-module.py
setup.py
README.rst
my subpackage init only has the following inside:
name = 'sub_a'
Here is my setup.py
from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='tools-sub-a',
version='1.0.0',
description='A sample Python project',
long_description=long_description,
url='none',
author='myuser',
author_email='[email protected]',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: Only For Internal Use',
'Programming Language :: Python :: 3.6.4'
],
keywords='none',
packages=['tools.sub_a'],
install_requires=[],
extras_require={},
package_data={},
data_files=[],
entry_points={},
project_urls={},
)
The package builds using python setup.py sdist, I transfer the tar.gz file over to the virtual environment directory root, and run
pip install --no-index --find-links=. tools-sub-a
This installs fine, however when I navigate to the virtual environment Lib/site-packages directory, the tools/sub_a directory structure is not there.
I see a tools_sub_a-1.0.0.dist-info, but none of the expected namespace package directories.
Upvotes: 3
Views: 317