Closed jmmitc06 closed 1 year ago
This is related to how to reuse asari in notebooks or other packages. Asari functions are usually in the name space of individual modules. My hunch is that, without any experience in reticulate, adding imports into asari.init may work.
There is now code to dynamically import all sub-modules into asari.init. May not be the cleanest solution but we can refine later.
^^ scratch this, while this made the functions available it broke all the imports and I did not catch it since I was accidently testing on the wrong version ^^
This issue has now been fixed. Strangely, dynamically populating all in init.py is not recognized by reticulate. I'm not sure why. This unfortunately means that I have to do the not so clever thing of just listing all the imports for the modules explicitly.
`
library(reticulate) x <- reticulate::import("asari") reticulate::py_list_attributes(x) [1] "builtins" "cached" "doc" "file" "loader" "name" "package"
[8] "path" "spec" "version" "analyze" "annotate_user_table" "chromatograms" "command_line"
[15] "constructors" "dashboard" "db" "default_parameters" "experiment" "json_encoder" "main"
[22] "mass_functions" "peaks" "qc" "samples" "workflow"`
You can also install from github from within Rstudio using the system
command. I assume that reticulate simply imports the package from the local install if present.
This is now implemented and it seems Lei has no further requirements.
From Lei with Jeff Xia:
Hi Joshua, how are you?
I'm trying to call asari in R using reticulate package (which is a interface to 'Python' modules, classes, and functions in R.), to interface with our tools in R. But after I import asari, there are no functions or modules, only the standard attributes that are available in all Python modules. Could you help me with that? Here attached is what I run in R.
`
Was able to replicate on my end, I believe this is a packaging issue.