How can I install a directory in a python module?

Viewed 64

I am writing a python module and need to install a directory along with the module. This is what my file tree looks like:

├── module
│   └── temp
│   |   └── __init.py__
|   |       file2.yaml
|   |       file.yaml
│   └── module.py
|       __init__.py
├── setup.py

As you can see, module.py is the main module with all my functions, but it needs to access what is in the temp directory. When I use setup tools to install my module locally, using pip, it installs the module.py perfectly, but it won't install the temp directory.

Here is my setup.py:

setup(name='module',
      packages=find_packages(),
      version=VERSION,
      description=DESCRIPTION,
      long_description=LONG_DESCRIPTION,
      license=LICENSE,
      author=AUTHORS,
      install_requires=[
          ],
      include_package_data=False
      )

My theory is that I need to pass something through find packages().

Side note: I am running setup.py as python setup.py bdist_wheel. To clarify, everything is working fine, my directory is just not being installed with the package.

When I go to where the package is stored, __init__.py and module.py are the only things that are installed in my module package directory.

How can I make sure that the temp directory is installed as well?

Any help is appreciated.

EDIT: My first file tree was wrong. The temp directory is inside the directory with the module.

1 Answers

When python install packages, the module directory will be copied to the directory like /usr/local/lib/python3.6/dist-packages/module. If you add the extra tmp directory, it may conflict with other module.
How about considering moving the tmp directory to the module directory. like this:

├── module
│   └── temp
│   |   └── __init.py__
|   |       file2.yaml
|   |       file.yaml
│   └── module.py
|       __init__.py
├── setup.py
Related