I am trying to package some of my Python code that calls R code using rpy2. That R code currently sits in a separate file which I source
from the Python script. For
How should I package the R support code, and once I have done so, how do I find the path to the R file so I can source it?
For the source files to be installed, you need to specify them in some way in package_data
. You can find their path in the exact same way as you do now.
The R code depends on several R packages. How can I ensure that these are installed? Should I just raise an informative error if these R packages cannot be loaded?
Either make setup.py
check if they exist (kind of "configtools approach") or just raise some kind of exception once you cannot load them. Or maybe do both of them, and then if for some reason the files you depend on disappear, at least you will know it.