I want to install a data file which is in my repository root when installing my package. I don't want to install it in a specific directory. It's a list of contributors which is loaded by an about dialog. So this file is not a package data file.
My setup.py:
setup(
...,
packages = find_packages('src'),
data_files = [
('share/myproject', ['CONTRIBUTORS.txt'])
])
The file is installed in $prefix/share/myproject. The actual path is irrelevant for me.
The documentation tells me:
The data files can also be accessed using the ResourceManager API,
by specifying a Requirement instead of a package name
from pkg_resources import Requirement, resource_filename
filename = resource_filename(Requirement.parse("myproject"),"share/myproject/CONTRIBUTORS.txt")
This returns a path relative to the site-packages directory. When installed in developer mode with pip install --user -e . this is relative to the src directory (from the find_packages call?). Both paths are not pointing to the correct file as they should if the documentation is correct.
If the data_file option is a supported feature then either the documentation is wrong or the ResourceManager is using the wrong path. If this is not supported any more then it needs to be removed from the documentation.
I want to install a data file which is in my repository root when installing my package. I don't want to install it in a specific directory. It's a list of contributors which is loaded by an about dialog. So this file is not a package data file.
My setup.py:
The file is installed in
$prefix/share/myproject. The actual path is irrelevant for me.The documentation tells me:
This returns a path relative to the
site-packagesdirectory. When installed in developer mode withpip install --user -e .this is relative to thesrcdirectory (from thefind_packagescall?). Both paths are not pointing to the correct file as they should if the documentation is correct.If the
data_fileoption is a supported feature then either the documentation is wrong or the ResourceManager is using the wrong path. If this is not supported any more then it needs to be removed from the documentation.