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

deployDoc does not include local requirements.txt file in the bundle #919

Closed
samperman opened this issue Jul 19, 2023 · 2 comments · Fixed by #920
Closed

deployDoc does not include local requirements.txt file in the bundle #919

samperman opened this issue Jul 19, 2023 · 2 comments · Fixed by #920
Assignees

Comments

@samperman
Copy link

I have an rmarkdown document using reticulate and also created my own requirements.txt file. If I run the following:

rsconnect::deployDoc("mydoc.Rmd", ...)

the resulting bundle includes a requirements.txt file that was generated by rsconnect rather than the one I had created.

As a workaround, this will do what i want:

rsconnect::deployApp(appDir = getwd(), appPrimaryDoc = "mydoc.Rmd", appFiles = c("mydoc.Rmd", "requirements.txt"), ...)
@aronatkins
Copy link
Contributor

This is happening because deployDoc uses rmarkdown::find_external_resources to scan the document for external dependencies; we do not incorporate additional, unreferenced files that live alongside the document.

rsconnect/R/deployDoc.R

Lines 51 to 75 in 647bb4d

if (isShinyRmd(path)) {
# deploy entire directory
appFiles <- NULL
} else if (isStaticFile(path)) {
taskStart(quiet, "Discovering document dependencies...")
resources <- rmarkdown::find_external_resources(path)
taskComplete(quiet, "Document dependencies discovered")
appFiles <- c(basename(path), resources$path)
if (file.exists(file.path(dirname(path), ".Rprofile"))) {
appFiles <- c(appFiles, ".Rprofile")
}
appFiles
} else {
# deploy just the file
appFiles <- basename(path)
}
list(
appDir = normalizePath(dirname(path)),
appPrimaryDoc = basename(path),
appFiles = appFiles
)
}

@hadley
Copy link
Member

hadley commented Jul 19, 2023

We could/should special case requirements.txt in the same way as .Rprofile.

@aronatkins aronatkins self-assigned this Jul 19, 2023
aronatkins added a commit that referenced this issue Jul 19, 2023
* deployDoc includes requirements.txt and renv.lock

fixes #919

* whitespace lint

* vectorized existence
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

Successfully merging a pull request may close this issue.

3 participants