-
Notifications
You must be signed in to change notification settings - Fork 16
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
CodeDepends as a backend for reproducible build systems #14
Comments
Drake looks like an interesting system, especially the parallel stuff. Can you point me to a small example analysis that uses it? Here's an example where I used CodeDepends to generate a graph representing the dependencies between top level expressions in an R script. I use it to map this simulation script into this graph. You may be able to do something like this to automatically generate the drake code from a simple R script. From what I've seen CodeDepends has many more tools to resolve dependencies for the graphs you're interested in relative to codetools. |
Thanks, @clarkfitzg! Drake has a small built-in canonical example analysis in the quickstart vignette on CRAN, and you can generate the underlying R script with I will look into your CodeDepends example. From your description, it sounds like that might even help with ropensci/drake#25. There is plenty of room to improve how drake tracks dependencies (also at ropensci/drake#11), and I hope some of those extra tools in CodeDepends can help. |
Another thing to be aware of, depending on exactly how you intend to use codetools, is that there are corner cases that it currently gets wrong:
( I think you may also be interested in some work I did during my thesis on input-aware caching via RCacheSuite (disclaimer, I haven't looked at that code in a while, though now that CodeDepends is on CRAN I intend to get back to it and push it out as well). Not exactly the same thing as make-like build systems, but related, I think. At least it does the same type of dependency calculation you probably want, using CodeDepends. |
@gmbecker interesting. Both drake and remake use storr to cache both code and targets, and RCacheSuite looks like it makes the code part easier. Incidentally, for drake, I would actually prefer f <- function(){
b = get("x", envir = globalenv())
digest::digest(1234)
}
codetools::findGlobals(f) # Incorrectly ignores x and digest. And I see that |
After digging into the package some more, I have decided against replacing |
Do you mind if I ask what made you come to that decision? It is your
prerogative, of course, but using two entirely different static code
frameworks in the same project can't be ideal. Are we missing functionality
that code tools gives you?
Best,
~G
…On Wed, Jun 14, 2017 at 8:07 AM, Will Landau ***@***.***> wrote:
After digging into the package some more, I have decided against
replacing codetools with CodeDepends in the preexisting internals of drake
<ropensci/drake#41 (comment)>.
However, I think CodeDepends will put the otherwise difficult issues
ropensci/drake#9 <ropensci/drake#9>
and ropensci/drake#25
<ropensci/drake#25> within reach, and I
look forward to getting started on these new features.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3dsX0xT7hs-UCCxbkAOdc43AQu3AxTks5sD_dKgaJpZM4N0XG->
.
--
Gabriel Becker, PhD
Associate Scientist (Bioinformatics)
Genentech Research
|
I definitely think
I also thought In any case, depending on how The features in ropensci/drake#11 and ropensci/drake#25 just deal with analyzing knitr reports and importing new projects into |
...I didn't explain that very well, so maybe I should add a tl;dr and a clarification: But I think |
FYI: this SO post elaborates on a piece of what I am looking for. |
Just found a nifty use for expr <- parse(text = c("a <- x + y", "b <- v + w"), keep.source = FALSE)
expr
## expression(a <- x + y, b <- v + w)
f <- function(){}
body(f) <- expr
## Warning in `body<-`(`*tmp*`, value = expression(a <- x + y, b <- v + w)) :
## using the first element of 'value' of type "expression"
codetools::findGlobals(f) # Does not include "a" or "b".
## [1] "<-" "+" "x" "y" With inputs <- CodeDepends::getInputs(expr)
union(
inputs@inputs,
names(inputs@functions)
)
## [1] "x" "y" "v" "w" "+" With the changes happening to |
Another thing I really like: |
Thanks.
Glad you're finding that useful. For the record that is fully customizable
via the function handlers (that's actually how it is implemented, with
default handlers for the functions I knew of off the top of my head that
would have NSE).
As new functions with NSE mechanics come online and become popular, they'll
need to be handled with custom handlers at first and then eventually rolled
into the default handlers once they are mature. Happy to consider pull
requests for that (and anything else, of course!)
…On Sat, Feb 17, 2018 at 10:47 AM, Will Landau ***@***.***> wrote:
Another thing I really like: CodeDepends separates out NSE symbols such
as the arguments to ggplot2::aes().
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3dsZNbcibNxXWPJqpUcXMX2j53fkwPks5tVx7JgaJpZM4N0XG->
.
--
Gabriel Becker, PhD
Scientist (Bioinformatics)
Genentech Research
|
I just learned about CodeDepends, and I am glad to find such an active effort in static code analysis. R-focused reproducible build systems like drake and remake (and of course, knitr) could seriously benefit (richfitz/remake#172, ropensci/drake#41). Drake and remake rely on dependency graphs of the relationships among the "targets" of a data analysis project, and the dependencies for these graphs are resolved using code analysis. For drake in particular, I am considering switching the backend from codetools to CodeDepends, and I am wondering if you think the transition would be worth the trouble. In general, what would you say are the main advantages of CodeDepends relative to codetools?
The text was updated successfully, but these errors were encountered: