I am creating a Python module (a wrapper for the C library), where I have some data files that need to be installed for the package to work (coefficients for the magnetic field model). In addition, after installation, the environment variable must be set to the folder in which the data files are located (or the C library will not work).
I think I was able to install the data files using the manifest file and include_package_data=True (the files correctly get into the directory where the package is installed, although if there are better ways, Iβm all ears). However, I am stuck in a variable variable.
- How can I get (in setup.py) the directory where the package was installed?
- How can I reliably set a constant environment variable in setup.py on all platforms?
- Is it possible to set the environment at runtime during package import? To find the directory, I can use
__file__ in __init.py__ and work from there, and enviromnent variables should not be followed. However, I'm not sure if the C extension will have access to the environment variable defined through the Python shell. Will it be?
source share