I would like to upload my package to PyPI using setuptools. Unfortunately only __init__.py
gets packaged, and files it imports are not packaged. As a result my package is distributed incomplete and fails on import. My file structure is as following:
./
./mypkg/__init__.py
./mypkg/folder1/class_a.py
./setup.py
./upload.sh
I am using following setup.py:
import setuptools
setuptools.setup(
name="mypkg",
version="0.0.2",
packages=['mypkg'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
Edit: The question is different from Why do I need to include sub-packages in setup.py in that it looks for any solutions to the problem, and linked question discusses the technical reasons for one of the possible solutions.
solution was to list the needed directories like:
import setuptools
setuptools.setup(
...
packages=['mypkg', 'mypkg.folder1'],
...
)
Further reading: Why do I need to include sub-packages in setup.py