I would like to include data files with a Python package. Is the best place to put them inside the actual package as suggested here, i.e.
setup.py
src/
mypkg/
__init__.py
module.py
data/
tables.dat
spoons.dat
forks.dat
or is there a better way to do this? What is the best way to retrieve a datafile from inside python? Should I use
mypkg.__path__ + 'data/tables.dat'
for example, or should I use
pkgutil.getdata('mypkg','tables.dat')
or again, is there another better way to do this?
Generally speaking, what is the current preferred way to deal with data inside Python packages?