Basically my python package is setup like:
module
\\_examples
\\_folder1
\\_file1.py
\\_file2.py
\\_folder2
\\_file1.py
\\_file2.py
I came across this post and spent some time figuring out how to add specific sub-modules to my package, so I will post my solution here.
In my package root folder, I have a setup.py file see doc
In this file, I have the following code:
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='package name',
version='0.4.1',
description='short description',
long_description=long_description,
long_description_content_type="text/markdown",
url='repository url',
author='My name',
author_email='my@e.mail',
license='MIT',
packages=['PackageName','PackageName.SubModule'],
zip_safe=False,
install_requires=[
'dependecy1',
],
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.7'
]
)
The interesting part to answer the question, here is :
packages=['PackageName','PackageName.SubModule'],
By following this syntax, you can include sub-modules to your main package distribution.
More info about all the others arguments can be found in the doc.