-
Notifications
You must be signed in to change notification settings - Fork 42
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
Assign .Depends to package environment to mimic more closely to library() #61
Conversation
Thanks, this seems like a good improvement! I think we should include your skeleton package in the pkgload tests to prevent regressions. Also if you could and note to NEWS.md describing the change, mentioning this issue number and your GitHub username. Thanks again for the PR |
Tests added without including the whole skeleton package, just to avoid it becoming bulky. I think this is preventive enough. NEWS.md updated as well. Travis Build failed twice due to poor network.. I'll do another PR close & reopen to re-trigger the build, which might make the thread a little messy. Hope you don't mind. |
Any other concerns I could address? |
No, it is good, thanks again! |
:P thanks |
In
load_all
, assign.Depends
to package environment, following the behavior in RattachNamespace()
, as shown in R-3-4-3/src/library/base/R/namespace.R#L165.It caused some issues that depend on this behavior, for example, using
data.table
withintest_that
.Previously, the workarounds are:
.datatable.aware = TRUE
(or other code) to package source file to make it data.table-aware. This is becausedata.table#cedta
check failed at L32 and we had to assign manually to make L37 work. See data.table#2053, devtools#192, dplyr#548,#' @import data.table
directive in R code instead, which is no more convenient than 1).The pain point is that we cannot use data.table within our package during dev phase. @mattdowle proposed 2 ways at answer. The ii) way ( 2) above) works for dev phase, but it requires source code changed. The i) way works only after package development is finished and when user uses
library()
to attach the package, so it's not convenient during development.This commit enables:
DESCRIPTION/Depends
declaration is required, no R code change needed, keeping package source cleandevtools::test()
workslibrary()
behaviorAs suggested by @hadley at devtools#1472, a minimal package to reproduce the error is created at skeleton_pkg:
With current
pkgload
:With modified
pkgload
: