-
Notifications
You must be signed in to change notification settings - Fork 152
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
capture source package with renv in package root #634
Comments
The current This implies that if you want to explicitly load and test that package, you'll need to install that package into the project library as a second step -- for example:
I think the fact that Am I correct that making sure |
Thanks for your quick answer.
Yes. Also relative paths would be nice, like
Maybe I don't have full context here but if you have the source code of the package, this is really all it needed to restore that package, isn't it? Like it would not make sense to restore a different version of the package than the one you just have here. But probably the use case is not very common and the introduced complexity to represent such a source package (I agree it would not extend well to situations where the renv project and the package source are not in the same directory) in |
In general, you also need all of the package's dependencies as well, though -- your package cannot be built and installed unless the packages it depends on are installed and available at build time. The development version better handles paths of the form "./path/to/package" now, so I think this issue can ultimately be closed. Feel free to re-open if I'm missing something. |
Thanks Kevin, I really appreciate your responsiveness. I'll try it out and come back in case of problems, but I don't expect there will be any 😊. |
I have an R package
{mypkg}
and I want to create a virtual environment where this (built) package and its dependencies are available. So I thought I could, in the root of the sources of{mypkg}
I am not sure why
{mypkg}
does not end up captured with{renv}
in both the lockfile and the library. This makes it (apparently) impossible to use it in non-dev workflows (e.g. without callingdevtools::load_all()
)In particular, I want to share my code with other people, so they could clone the repo and use
renv::restore()
and thenlibrary(mypkg)
without the requirements of the{devtools}
toolchain. Next, I triedrenv::install(".")
, beacuse in the help file forrenv::install()
, I sawrenv::install("~/path/to/package")
. This didn't do what I wanted either.Last attempt was
remotes::install_local()
, which installed the package properly, but:renv/
at that point (I could move the folder outside the package sources as I found out in the documentation though, but I think it's better to make{remotes}
respect.Rbuildignore
, e.g. as suggested in Avoid copying .Rbuildignore files in install_local() r-lib/remotes#107.Given my understanding and challenges, I think when
renv::init()
is called in a package directory, it should also install that package and make it available onrenv::restore()
, potentially add it to the lock file (maybe this requires to extend the lockfile specs for this particular case). Alternatives are that at leastrenv::install(".")
would install the package properly and there is a way to add it to the lockfile. Putting a library statement in some random file should not be the solution to this I think, in particular not since for this to work, I couldn't useAnymore (I think) and all dev deps would have to be installed. I found #624, which is related.
Context: I am trying to add renv as a supported language for https://pre-commit.com (partly tracked in lorenzwalthert/precommit#215).
The text was updated successfully, but these errors were encountered: