I want to create a python package with below folder structure:
/package
/package
__init__.py
/main
__init__.py
main.py
...
/data
__init__.py
constants.py <--
data.yml
pyproject.toml
...
And inside constants.py, I defined the path to data.yml:
DATA_PATH = './data.yml' and used it in main.py:
from package.data.constants import DATA_PATH
with open(DATA_PATH, 'r') as f:
...
Then I build and installed the package into another project.
But when some code of main is used, it complains about "No such file or directory".
I also tried './data/data.yml' and './package/data/data.yml'and none worked.
How should I define the path?