pak icon indicating copy to clipboard operation
pak copied to clipboard

`pak()` may need to prioritize Remotes more

Open DavisVaughan opened this issue 2 years ago • 2 comments

I can replicate a scenario where:

  • workflows has a Remote for tidymodels/parsnip@feature/case-weights
  • You can do pak::pak("tidymodels/workflows") to install the dev version of workflows and the remote (good)
  • You then downgrade the remote back to just pak::pak("tidymodels/parsnip") (good)
  • Running pak::pak("tidymodels/workflows") again won't reinstall the remote. It decides no changes are necessary. (bad)

You can reproduce with this chain of calls:

# Force installation of both dev versions to start with
pak::pak("tidymodels/workflows")
pak::pak("tidymodels/parsnip@feature/case-weights")

# Restart R

# Now revert back to just dev parsnip, which isn't good enough for workflows
pak::pak("tidymodels/parsnip")

# Restart R

# Now try to install dev workflows, which has a Remote on 
# tidymodels/parsnip@feature/case-weights.
# For me this doesn't reinstall the Remote.
pak::pak("tidymodels/workflows")

I was expecting the tidymodels/parsnip@feature/case-weights remote to be reinstalled

DavisVaughan avatar May 18 '22 15:05 DavisVaughan

The reprex does not work any more, but I am pretty sure that this is https://github.com/r-lib/pkgdepends/issues/227

gaborcsardi avatar Aug 23 '22 06:08 gaborcsardi

I made some repos for you to reproduce it again. https://github.com/DavisVaughan/testpakremote1 https://github.com/DavisVaughan/testpakremote2

  • testpakremote2 has a Remote for DavisVaughan/testpakremote1@bar
  • You can do pak::pak("DavisVaughan/testpakremote2") to install the dev version of testpakremote2 and the remote of testpakremote1 (good)
  • You then downgrade the remote back to just pak::pak("DavisVaughan/testpakremote1") (good)
  • Running pak::pak("DavisVaughan/testpakremote2") again won't reinstall the remote. It decides no changes are necessary. (bad)
pak::pak("DavisVaughan/testpakremote2")

# this was added in the branch `DavisVaughan/testpakremote1@bar`
testpakremote1::bar(1)

# Downgrade
pak::pak("DavisVaughan/testpakremote1")

# Restart R

# Try again
pak::pak("DavisVaughan/testpakremote2")

# `DavisVaughan/testpakremote1@bar` branch wasn't installed
"bar" %in% names(asNamespace("testpakremote1"))

DavisVaughan avatar Aug 23 '22 12:08 DavisVaughan