There are many variations on this question I've found, but none seem to address my exact situation where
- The Python code for the project is contained in a single file
- There are required data directories that must be included with the installation
I am trying to create a pip
-installable version of the following Python project, where the project consists of a single Python script myscript
, plus two different data directories, data
and test_data
. data
contains required data files that are sourced by myscript.py
at runtime:
myscript
|
├── myscript
│ ├── data
│ ├── __init__.py
│ ├── myscript.py
│ └── test_data
├── LICENSE
├── README.md
└── setup.py
I've seen the recommendation to use py_modules
in setup.py
for similar issues, but that doesn't seem to allow for inclusion of the data directories upon install with pip
, and I cannot find documentation that seems to cover this specific case.
I've also seen it recommended to just have users do a git clone
of the repo instead of using pip
, but it seems like a usability benefit to offer a way to pip
-install with all dependencies while correctly adding the script to the PATH in an OS-dependent manner.