-
Notifications
You must be signed in to change notification settings - Fork 91
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
added support for pacman::p_load package loaders #360
base: main
Are you sure you want to change the base?
Conversation
I fixed the problem in deploying by installing I also created a simple test file to test the changes. There are some known limitations: supported syntax
unsupported syntax
note pacman package itself will be picked up by original code no matter what: |
I added a Rmarkdown to explain more details, and a test file I used to test the code. The test file is just a script with different pacman syntax. Proper testthat test case can be added later if needed. This test file caused some error in CI checks. However the test will need a file (cannot run with a string), and I'm not sure how to avoid this error unless I put the file elsewhere. |
Hi @jcheng5 do you have time to review the PR? |
… caused by test code inside testthat folder
Thanks for taking the time to create this PR. However, I'd prefer to avoid adding this directly to Packrat (which would imply we'd have to maintain + update it), and instead provide a mechanism for users to register their own dependency resolution routines. |
If Then I can suggest to add this feature to |
Would be very nice to get this merged or otherwise made possible... |
Background: issue in rsconnect and pacman
The issue is packrat doesn't recognize pacman package loader calls.
First I tried the methods used in original code for checking
library
,require
, but thematch.call
method doesn't work withpacman::p_load
because the package name argument is not named.Then I just scan the arguments in the pacman loader call, excludes all other arguments that are not package names, then add the package names to the environment.
I tested the code in file level
packrat:::fileDependencies(file)
which seemed be able to recognize pacman loader correctly. However when I tried to deploy my shiny apps with pacman loader using my custom built packrat, there is errorI'm not sure how to fix this error since I'm just building and loading my version of packrat, which could cause some problems. I'm submitting the pull request for review first.
If there is some method to avoid the error in shiny deployment, I'll test more with shiny deployment with my code.
Known limitations:
p_load_gh
is not implemented because the github repo string could be quite complicated. Instead user just need to load that package inp_load
again, which will make sure the packages be picked up bypackrat
, and there is no negative impact of this.