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

How to use pak & renv together #436

Closed
telegott opened this issue Nov 30, 2022 · 5 comments
Closed

How to use pak & renv together #436

telegott opened this issue Nov 30, 2022 · 5 comments

Comments

@telegott
Copy link

I have a project that should be deployed as a docker container, that means:

  • I need an isolated library for development
  • I need a way to fix package versions that I use during development
  • Exactly these versions should install in the container, if possible from a plain lockfile, without recreating any isolated environment
  • The package installation in the container should be fast.

I do not want to follow the R package structure, since I want to use box and nested modules.
renv is not exactly speedy, which is why I wanted to try pak. However, if I'm correct, pak does not setup a per-project library like renv does.

Using pak only in the container is not possible either, since it can't install from renv.lock.

I was wondering whether it's possible to use both together:

  • renv::init(bare=TRUE) to set up the project library
  • install pak
  • add a package to DESCRIPTION
  • do pak::lockfile_create() to snapshot the package mentioned in DESCRIPTION and their exact versions
  • copy that lockfile to the container, and to pak::lockfile_install() in the container

What would be the recommended approach to have something similar to poetry, a file that describes the project dependencies, an isolated library, a lockfile, and as bare-bones as possible recreation in an isolated environment like docker?

@telegott telegott changed the title How to use pak & renv How to use pak & renv together Nov 30, 2022
@gaborcsardi
Copy link
Member

There is no current recommended approach to use pak and renv together, you are a pioneer here, for better or worse.

pak will potentially be able to install packages from an renv lockfile: #343. I guess that would solve most (all?) of your problems.

@telegott
Copy link
Author

telegott commented Dec 2, 2022

@gaborcsardi thanks for your answer! So I get it right that pak can't replace renv in terms of local development per-project library isolation?

@gaborcsardi
Copy link
Member

Not currently, no. pak does not do anything with libraries currently. It installs into the first library on .libPaths() by default. So if you set up your libraries manually or with another tool, then pak will happily use the default library.

@telegott
Copy link
Author

telegott commented Dec 9, 2022

@gaborcsardi thanks, will look into this!

@gaborcsardi
Copy link
Member

renv now supports pak for installing packages, so I am going to close this.

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