Python snap: where are static data files?

My python project includes some static text files of the sort to be included in the package_data section of setup.py. These text files are opened and read by the python application at least once during its lifecycle. However, these don’t seem to make it into the snap build anywhere (nowhere under /snap/<app_name>/ or ~/snap/. How can I ensure these static .txt files are included in the snap and accessible by the binaries?

Thanks in advance.

As described in the Python packaging documentation, files listed in package_data will be installed to the directory containing the package. Taking the example from the documentation:

package_data={
    'sample': ['package_data.dat'],
},

… you will end up with the files installed as:

.../sample
  - __init__.py
  - package_data.dat

From a module within the package, you can construct the file path for the data file with something like:

data = os.path.join(os.path.dirname(__file__), 'package_data.dat')

Tanks for the tip, I’ll try that.