Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching in loaded packages from flow_view_uses ? #190

Open
llrs opened this issue Nov 6, 2024 · 2 comments
Open

Searching in loaded packages from flow_view_uses ? #190

llrs opened this issue Nov 6, 2024 · 2 comments

Comments

@llrs
Copy link
Contributor

llrs commented Nov 6, 2024

I'm trying to use flow to see the dependencies of functions between several packages. I want to know if I change package function (A::func_a) how it will impact other packages (B::func_b, C::func_c).

I thought that by loading the other packages flow_view_uses would be able to find the function usage inside all of them. Based on the following example I need to specify which package namespace I want to search:

library("teal.logger") # Changed function log_shiny_input_changes
library("teal.modules.clinical") # From github, uses function here: https://github.com/insightsengineering/teal.modules.clinical/blob/5b9192679cf2e670584a81c815bb1ec4267c4c7a/R/tm_a_mmrm.R#L854
library("flow")
flow_view_uses(log_shiny_input_changes) # Doesn't show any node
flow_view_uses(log_shiny_input_changes, pkg = "teal.modules.clinical") # Works

Is it possible to extend flow_view_uses to look up in all the namespace?

@moodymudskipper
Copy link
Owner

I believe you mean pkg = "teal.modules.clinical", and by namespace you might mean workspace ?

Looking into several namespaces at the same time would open a can of worm because functions there might depend on each other too, though it could be a feature I guess, to see all indirect dependencies this way.

It seems feasible, we need several things though:

  • support multiple pkg
  • display pkg:: when there are several
  • suggest loadedNamespaces() as a value to consider all loaded packages

For multiple packages to work well, we need to actually check for fake friends (homonym functions), by checking if the searched items are accessible from the environment.

It is feasible and I see the value.

I'll start tagging the issues with help-wanted because I don't have so much time for flow these days

@llrs
Copy link
Contributor Author

llrs commented Nov 7, 2024

Yes, I meant pkg = , sorry.

That looks like a plan that could work, I thought that flow_view_uses already consider fake friends... but I see the issues it could face.

I'll see if I can understand better how flow works and help more. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants