Packaging supporting R code in a python module?

后端 未结 3 1157
天命终不由人
天命终不由人 2021-02-02 17:45

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

3条回答
  •  借酒劲吻你
    2021-02-02 18:29

    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.

提交回复
热议问题