-
Notifications
You must be signed in to change notification settings - Fork 155
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
Suggests
dependencies included by default
#1019
Comments
For R packages managed by renv, the Suggests dependencies from the DESCRIPTION file are included by default, under the assumption that those packages would be required for testing (or other similar runtime requirements). If you change the snapshot type to "explicit", then the issue should go away:
|
Thanks for the explanation, and yes while I can understand that they'd be needed for testing and / or building the package, they wouldn't be needed for runtime operation of doing whatever it is the package happens to do. I think including them by default adds a lot of unnecessary bloat to the Using the explicit snapshot type (as I understand) would affect how all (including non-Suggests) packages are captured and so doesn't feel like a great solution (or at least not what I'd hope to achieve). I've seen some discussion of separate development dependency groups, but until / if that is merged, could I suggest some combination of either:
Thanks |
Thanks; I think I agree with your assessment that even if the default is to not include Suggested packages, the user should be able to configure that behavior (probably via the |
Suggests
dependencies not being ignored by default on renv 0.15.5Suggests
dependencies included by default
I would expect @kevinushey do you think it's possible to make this change now without breaking expected behaviour? (i.e. should I just document it?) |
Per #1336, this also seems to be a problem if you explicitly specific the dependencies. |
I'd be on board making this change even if it meant breaking some existing behaviors, since the current behavior seems unintuitive. |
In If the default snapshot type has been switched to Then need to update |
Once #1394 (the culmination of a bunch of refactoring) is merged, this should be straightforward to implement — we can add a |
I've just upgraded to the new v1.0.0 - does this change mean that its no longer possible to have snapshot type of "implicit", and include packages from Suggests when snapshotting? I can't see how to do so as setting I have packages in Suggests that I'd like to be included in my lockfile when snapshotting and restoring (while keeping the 'implicit' snapshot type) - what would be the way to achieve this? IOW is there a way to snapshot() development dependencies or has that possibility been removed? |
No, implicit dependencies still look at any If you want to snapshot development dependencies, it sounds like they might just be regular dependencies? Or at least it's not clear to me, what the difference would be. |
Here's what I see:
Because we treat these as development dependencies, they won't enter the lockfile unless they're explicitly used elsewhere in the project (e.g. in the above case you'd need |
I guess part of the question here is: why do you want to record these packages in Suggests if you also want them to be in the lockfile? Can you expand a bit more on your project structure? |
Hi, thanks both for the responses - this might just be down to my misunderstanding of how renv should be used or what development dependencies are! I have a shiny app that is structured as a package, and have put packages under Suggests like devtools, testthat, covr etc. The reason I'd like these in my lockfile is our CI pipeline |
Hello! I am facing a situation in this area and I can explain my project structure and workflow. My project was using {renv} 0.15.4 where the Suggests packages were being captured with When we are ready to make pull requests, everything is done in Azure DevOps. I have a custom-built solution for making things work in Azure pipelines; pretty much a docker solution that will Error within Azure Devops:
I tried adding the Suggests field with As a bandaid, I have put my Suggests packages in my |
If you want packages to be tracked in the snapshot, then I think you should just list them in Imports instead of Suggests. Alternatively, you could call |
The main ideas I think are two:
Package managers such as npm or yarn (javascript) or composer (php) work exactly this way. They make no difference between dev and production dependencies except simply separating them into two sets which you can install independently. But if a dev dependency breaks constraints of a prod one or vice-versa, the install will fail (i.e. when installing everything, the two sets are merged together and the entire set must resolve properly). Because I guess historically R packages worked in a different way and Suggest was really just a suggestion for some (manual?) action, this logic might not completely map to the DESCRIPTION file. In our project, I'm actually using a non-standard |
Re-opening for future consideration (can we include development dependencies in the lockfile? or in an alternate "dev" lockfile?) |
I'm in the process of upgrading to renv Workflow A - working on the project
Workflow B - building a docker image
I think there is a disconnect between what is recorded in the lock file and what is restored. I see the restore action as taking any subset of the lockfile and installing that, of course provided the subset is consistent. That is how it works in other package managers most commonly. Right now I see as a workaround to generate two snapshots, one |
I think that's the correct approach currently, given that lockfiles currently do not record whether a particular package is considered a development dependency or not -- the current assumption is that a lockfile should include only non-development dependencies. |
Following up on this, what's the current best practice for a situation where I have a subset of packages that I would want restored when in a production setting, but otherwise, I can restore all of the packages? For example, say I have these packages listed in my DESCRIPTION.
For production, I want only the |
Hi,
I'm experiencing (I think), the same issue as #823. But since that is a little stale (and on an older version) I thought I'd raise the issue here again.
Using, renv 0.15.5
Reproduce as before,
usethis::create_package("suggestdemo")
)renv::init()
and restart the R sessionSuggests
-field to theDESCRIPTION
file (for instanceSuggests: knitr
)renv::status()
The result is
Note also,
And finally,
My expectation would be to not see
knitr
inrenv::status
and to see it listed as a development TRUE dependency inrenv::dependencies
Thanks
The text was updated successfully, but these errors were encountered: