I have this folder structure:
my-package -
|- src/mypackage
|- resources/some-resources
|- setup.py
|- setup.cfg
I want to load some-resources
from within mypackage
. How do I do this?
I have read online I should update my setup.py
to include:
setup(
...
package_data={"": ["resources"]},
include_package_data=True,
...
)
And that I should then be able to use pkg_resources
to access my resource
folder. But the examples seem like they are incomplete, e.g. pkg_resources.resource_listdir("mypackage", "")
(one suggestion) just lists the python files in mypackage
. So to reiterate - how do I include resources
in my package, and then access them from my code?