'Install modules with setup.py and setup.cfg

I have the following directory structure:

/modules/
/modules/setup.py
/modules/setup.cfg

/modules/module1/
/modules/module1/__init__.py
/modules/module1/tool1/__init__.py
/modules/module1/tool1/tool1.py

/modules/module2/
/modules/module2/__init__.py
/modules/module2/tool2/__init__.py
/modules/module2/tool2/tool2.py
/modules/module2/tool3/__init__.py
/modules/module2/tool3/tool3.py

And I want to install these modules using setup.py and setup.cfg and import them later on like this:

import my_project.module1.tool1 
import my_project.module2.tool2
import my_project.module2.tool3 

These are my installation files:

setup.py

import setuptools

setuptools.setup(
    setup_requires=['paramiko>=2.0.1'],
    paramiko=True)

setup.cfg

[metadata]
name = my_project
summary = my project modules

[files]
packages =
    module1
    module2

It fails when I try to install the packages:

/modules# pip install -e .
Obtaining file:///modules
Installing collected packages: UNKNOWN
  Found existing installation: UNKNOWN 0.0.0
    Can't uninstall 'UNKNOWN'. No files were found to uninstall.
  Running setup.py develop for UNKNOWN
Successfully installed UNKNOWN


Solution 1:[1]

Try using the find_packages function:

from setuptools import setup, find_packages
...
setup(
    ...
    packages=find_packages(),
    ...

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Marcin Cuprjak