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

workflow/option to install packages locally #12

Open
njtierney opened this issue Oct 25, 2021 · 7 comments
Open

workflow/option to install packages locally #12

njtierney opened this issue Oct 25, 2021 · 7 comments

Comments

@njtierney
Copy link
Contributor

Basically I would like something like capsule::reproduce_lib() but that installs the packages locally for interactive use outside of the capsule::run workflow.

Perhaps the function could be called:

install_lockfile_pkgs() or something?

@njtierney
Copy link
Contributor Author

Actually would

renv::hydrate()

Just do this?

@MilesMcBain
Copy link
Owner

MilesMcBain commented Oct 26, 2021

I dont think so... I think that tries to discover your deps from your code.

The subtle issue that arises is that the lockfile versions may not be compatible with your local library due to being outdated. I.e. the version may be below the min version of other dependent installed packages. With your local library, the only safe direction to move is forward to install the latest.

So if you do this:

capsule::get_pkg_behind_capsule()$name |> install.packages()

I think that will install the latest versions of packages that are behind the lockfile or not present. This would ensure you are at or in front of the lockfile versions.

edit: need the $name!

@MilesMcBain
Copy link
Owner

If this is what you want, happy to wrap it up in its own function.

@njtierney
Copy link
Contributor Author

That would be amazing!

@MilesMcBain
Copy link
Owner

MilesMcBain commented Oct 28, 2021

Notes for myself mostly:

I think this kind of thing should be what solves this: renv::restore(packages = capsule::get_pkg_behind_capsule()$name, prompt = FALSE)

A few issues a present:

  • if packages is zero length renv::restore appears to ignore it and do a regular restore, which can downgrade your lib. Need guard rails to stop that from happening.
  • capsule::get_pkg_behind_capsule() only considers the declared deps, not all the recursive deps. For this to work it needs to be able to consider the complete set. get_project_deps(detect_dependencies(dep_source_paths)) should do it.

@MilesMcBain
Copy link
Owner

Have a try of capsule::dev_mirror_lockfile().

Which does not infact mirror the lockfile. It makes sure all deps are at least the lockfile versions, the ones ahead are not touched. So... it's kind of like a funhouse mirror.

@MilesMcBain
Copy link
Owner

Example:

image

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