I have developed a Python package. My structure is the following :
- my_package
- conf
...
- src
- my_package
- main.py
...
For the package to perform, I need to read some configuration files from the conf directory. Initially, I was thinking about putting the conf directory outside the package to expose it to the user when he clones the package repository so that the user can easily see the files found inside it and modify them as he needs to.
Of course, the user can change the path to the configuration files so that it matches its location.
BUT I also want the package to run out of the box when installed. Therefore, inside the code, the default values are set relative to the main.py. This works in development mode.
However, when installing the package, the structure changes and becomes :
- /some/path/to/env/Lib/site-packages/my_package.egg
- conf
- my_package
main.py
and I lose one level in the structure thereby breaking my relative path initially set-up. Am I doing something wrong ? I followed these principles for packaging. I could of course easily add like a dev flag which changes the way paths are treated during development mode vs production mode. But I feel I am missing something more fundamental in the packaging rules and I want to be sure.
Thanks !