'Create python distribution for multiple subpackages

I want to create multiple sub-packages and distribute them individually. The obvious solution is to create a multiple setup.py for each sub-package and create a script that can frontend the creation and distribution of those packages. However, I am not sure if this is a good idea and if its the right way to do it. Any recommendations? I looked into namespace packages but thats not exactly what I need, my goal is it ship slim packages with minimal dependencies and thats why I am breaking my project into multiple subpackages that can be distributed

Second question so currently I have the following structure

a/b/c
     __init__.py
     setup.py
     1.py
     2.py
     subpackage/
               __init__.py
               3.py
               setup.py

Now when I create a sdist using

python a/b/c/subpackage/setup.py sdist bdist_wheel

it adds all the files from top level directory too e.g 1.py 2.py but I would like to only distribute the files from subpackage dir. How can I force it only add files from subpackage dir?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source