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

avoid repeated package dependency processing #615

Merged
merged 5 commits into from
Nov 30, 2020
Merged

avoid repeated package dependency processing #615

merged 5 commits into from
Nov 30, 2020

Conversation

aronatkins
Copy link
Contributor

an alternate tree-pruning approach from #614; part of an ongoing discussion with @andrie

@kevinushey
Copy link
Contributor

This PR looks good to me, although I think we might need to narrow the scope a bit more since (if I understand the test failures correctly) some APIs do rely on us building the full dependency tree for packages.

What if we instead hid this behavior behind an option, e.g. something like options(packrat.PruneDependencyTree = TRUE), and set that for rsconnect's usages of Packrat?

@aronatkins
Copy link
Contributor Author

Updated the approach to prune the search while still producing the full dependency tree.

R/pkg.R Outdated
priorPkgRecords <- c()
for (pkgName in pkgNames) {
if (exists(pkgName, envir = .visited.packages)) {
append(priorPkgRecords, get(pkgName, envir = .visited.packages))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
append(priorPkgRecords, get(pkgName, envir = .visited.packages))
priorPkgRecords <- append(priorPkgRecords, get(pkgName, envir = .visited.packages))

As is, this statement won't update priorPkgRecords -- is that intentional?

@kevinushey
Copy link
Contributor

LGTM! (Remaining test failures are due to dependent R packages not being available for older R.)

Copy link
Contributor

@kevinushey kevinushey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- thanks for putting this together! (And thanks to @andrie for getting this work started as well.)

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

Successfully merging this pull request may close these issues.

2 participants