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

Warn when Shiny app has a DESCRIPTION file #192

Closed
jmcphers opened this issue Jul 21, 2017 · 7 comments
Closed

Warn when Shiny app has a DESCRIPTION file #192

jmcphers opened this issue Jul 21, 2017 · 7 comments
Labels
dependencies 🐀 feature a feature request or enhancement logging 🌳

Comments

@jmcphers
Copy link
Member

jmcphers commented Jul 21, 2017

Repro:

  1. Create a Shiny application which uses a library not part of Shiny, such as library(plumber)
  2. Add to its directory a DESCRIPTION file which looks like a package's DESCRIPTION file
  3. Publish the application

The application publishes, but doesn't work on the server since it's missing the plumber library.

Here's an example DESCRIPTION that's known to be problematic:

Package: placeholder
Title: Does not matter.
Version: 0.0.1
Imports: bookdown
Remotes: rstudio/bookdown

The problem is that when there's a DESCRIPTION file, packrat uses the packages named in that file instead of scanning the code for dependencies. This happens in packrat here:

https://github.com/rstudio/packrat/blob/f29ca870a6254859de034b7a811f31f5e9caa4bc/R/dependencies.R#L55-L81

We could fix this in a couple of ways:

  1. Omit DESCRIPTION from the directory while packrat is scanning the directory.
  2. Add a flag (or environment variable, etc.) to packrat's snapshot that indicates that the directory should not be treated as a package even if it looks like one.
@jjallaire
Copy link
Member

jjallaire commented Jul 21, 2017 via email

@jmcphers
Copy link
Member Author

Unfortunately the DESCRIPTION here is from a printed copy of the bookdown book (see https://bookdown.org/yihui/bookdown/github.html), so anyone copying from that example is going to run into trouble.

@jjallaire
Copy link
Member

jjallaire commented Jul 21, 2017 via email

@kevinushey
Copy link
Contributor

The example has since been updated to use Type: Book, and that appears to work fine on Travis, so I think this should imply that the issue is resolved. In general, projects that use a DESCRIPTION file that don't want to appear like an R package to Packrat need to explicitly set the Type: field.

@koverholt
Copy link

Ran into this today with a user publishing a Shiny app to RStudio Connect.

Symptoms were that app.R was sometimes not included in the app bundle, or errors such as Warning: Error in library: there is no package called ‘feather’

Removing the DESCRIPTION file from the project dir worked.

Could rsconnect warn when this file is present?

@jmcphers jmcphers changed the title Dependencies not detected for applications with DESCRIPTION Warn when Shiny app has a DEPENDENCIES file Nov 14, 2019
@jmcphers jmcphers changed the title Warn when Shiny app has a DEPENDENCIES file Warn when Shiny app has a DESRIPTION file Nov 14, 2019
@hadley hadley changed the title Warn when Shiny app has a DESRIPTION file Warn when Shiny app has a DESCRIPTION file Feb 21, 2023
@hadley
Copy link
Member

hadley commented Feb 21, 2023

IMO the current behaviour is correct, because we want to give people the ability to explicitly specify package dependencies with a DESCRIPTION file. But we need to make it more clear when this behaviour is used, and how to change it.

@hadley hadley added logging 🌳 feature a feature request or enhancement and removed linting 🧥 labels Feb 21, 2023
@hadley
Copy link
Member

hadley commented Mar 20, 2023

This is no longer an issue because we set options("packrat.dependency.discovery.renv" = TRUE), and renv combines packages from the DESCRIPTION with packages discovered elsewhere.

@hadley hadley closed this as completed Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 🐀 feature a feature request or enhancement logging 🌳
Projects
None yet
Development

No branches or pull requests

5 participants