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

Error when a vignette fragment is imported through 'child=' code chuck option #17

Closed
MalgorzataOles opened this issue Jun 20, 2017 · 11 comments
Labels

Comments

@MalgorzataOles
Copy link

Hi,

I'm encountering problems during BiocCheck, which are likely caused by the functions not finding vignette files. In the package I have a master vignette which serves as skeleton for including parts placed in "src" subfolder by using child= code chunk option. BiocCheck fails during line parsedCode <- parseFiles(package_dir). The linked toy example reproduces the described behavior, see also the output below.

Best regards,
Małgorzata

> R CMD BiocCheck toy_0.1.3.tar.gz 
This is BiocCheck version 1.13.1. BiocCheck is a work in progress.
Output and severity of issues may change. Installing package...
* Checking for version number mismatch...
    This is not a software package, skipping vignette checks...
* Checking version number...
* Checking version number validity...
    Package version 0.1.3; pre-release
* Checking R Version dependency...
* Checking biocViews...
* Checking that biocViews are present...
* Checking for non-trivial biocViews...
* Checking that biocViews come from the same category...
* Checking biocViews validity...
* Checking for recommended biocViews...
* Checking build system compatibility...
* Checking for blank lines in DESCRIPTION...
* Checking for whitespace in DESCRIPTION field names...
* Checking that Package field matches directory/tarball name...
* Checking for Version field...
* Checking for valid maintainer...
* Checking unit tests...
    * NOTE: Consider adding unit tests. We strongly encourage them. See
      http://bioconductor.org/developers/how-to/unitTesting-guidelines/.
Loading required namespace: knitr
Error in readLines(if (is.character(input2)) { :
  cannot open the connection
Calls: <Anonymous> -> BiocCheck -> parseFiles -> parseFile
Execution halted
@aoles aoles added the bug label Sep 14, 2017
@sgibb
Copy link

sgibb commented Oct 5, 2017

Same problem here. There reason seems to be that parseFile copies the vignette into a temporary directory but doesn't copy the included files:

BiocCheck/R/util.R

Lines 165 to 173 in fed2f4d

outfile <- file.path(tempdir(), "parseFile.tmp")
# copy file to work around https://github.com/yihui/knitr/issues/970
# which is actually fixed but not in CRAN yet (3/16/15)
tmpin <- file.path(tempdir(), basename(infile))
file.copy(infile, tmpin)
suppressWarnings(suppressMessages(capture.output({
knitr::purl(tmpin, outfile, documentation=0L)
})))
file.remove(tmpin)

sgibb added a commit to sgibb/topdownr that referenced this issue Oct 5, 2017
BiocCheck fails with an error if a vignette loads additional
markdown-files.
See Bioconductor/BiocCheck#17
This commit should revert in the near future.
@mtmorgan mtmorgan self-assigned this Oct 5, 2017
@llrs
Copy link
Contributor

llrs commented May 11, 2020

Maybe this old issue is a good issue to take care of in the hackathon ? Although usually not a lot of packages use this functionality...

@mblue9
Copy link

mblue9 commented Sep 24, 2020

I just ran into this error. As was trying to find a way to share the same code across Bioconductor vignette and README to reduce code duplication and maintenance, and found a nifty method to share the content using man/fragments.

It works well for a CRAN package (tidyseurat) but it fails with a couple of Bioconductor packages I tried it with here and here, as BiocCheck gives the same error as reported in this issue. Seems also due to child= being used. Would be great if there was a way to make it work.

(ping @stemangiola)

@stemangiola
Copy link

stemangiola commented Sep 24, 2020

If I can add my two cents, reconciling the RADME and Vignette roles is something that many projects are trying to do, with a long list of discussion and blog posts.

Furthermore re-utilizing code chunks is incredibly useful to build educational resources around GitHub and Bioconductor.

I would strongly up-vote for tackling this problem with some priority.

@mtmorgan
Copy link
Collaborator

FWIW a straightforward solution is to make the README a symbolic link to a relevant vignette. Another approach is to use a github action to create the README.md from a vignette (modifying https://github.com/r-lib/actions/tree/master/examples#render-readme; implemented (poorly) at https://github.com/Bioconductor/Gen3/blob/master/.github/workflows/render-vignette-as-readme.yaml)

If this comment #17 (comment) is on the right track then perhaps there is a pull request that could be developed?

@mblue9
Copy link

mblue9 commented Sep 26, 2020

Thanks for the suggestions! They are interesting I hadn't thought of trying things like that.

I guess that the symlink and github actions methods would require the vignette and README to be identical? With the child method it's quite flexible as you can also have some differences between them. In our case we only have small differences at the moment e.g. including the GitHub actions badge in the README but not in the vignette. But maybe some people might want to include just some of the vignette, or parts from different vignettes. So I think it could be good if possible to find a way to allow the child method and as that would solve the OP's issue with wanting to include child docs.

That comment seems to be on the right track, that the extra files aren't getting copied to where the vignette is being built. As, because this child method works with R CMD Check, I had a look to try to see how they get it to work there. I found this SO post https://stackoverflow.com/questions/50078849/package-build-fails-because-vignette-does-not-find-child-rmd-files It seems they had the same issue with including child docs and it was fixed I think through this patch to R mentioned in that SO post https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17416. But I don't know if that would work here?

@anhtr
Copy link

anhtr commented Mar 2, 2021

I got similar issue when using BiocCheck in GitHub Action. It took me a few days to figure out what's wrong. I thought there's a problem with the library call check. It seemed due to the fact that I used child = in vignettes and readme. I wish there's a way to skip that check. Right now the parseFiles call will be executed regardless of any argument in BiocCheck, and it's not very clear why one would get the error without digging deep into the inner working of the function.

Bioconductor version 3.12 (BiocManager 1.30.10), ?BiocManager::install for help
This is BiocCheck version 1.26.0. BiocCheck is a work in progress.
Output and severity of issues may change. Installing package...
* Checking Package Dependencies...
Warning in system2(cmd, args, stdout = TRUE, stderr = FALSE, env = "R_DEFAULT_PACKAGES=NULL") :
  running command 'R_DEFAULT_PACKAGES=NULL '/usr/local/lib/R/bin/R' -q --vanilla --slave -f /__w/_temp/Library/BiocCheck/script/checkBadDeps.R --args "/tmp/RtmpQa0lvD/filed677dc33c12/lib/HPAanalyze" 2>/dev/null' had status 1
* Checking if other packages can import this one...
* Checking to see if we understand object initialization...
* Checking for deprecated package usage...
* Checking for remote package usage...
* Checking version number...
* Checking for version number mismatch...
* Checking version number validity...
* Checking package size...
    * ERROR: Package Source tarball exceeds Bioconductor size
      requirement.
        Package Size: 10.3922 MB
        Size Requirement: 5.0000 MB
* Checking individual file sizes...
* Checking biocViews...
* Checking that biocViews are present...
* Checking package type based on biocViews...
    Software
* Checking for non-trivial biocViews...
* Checking that biocViews come from the same category...
* Checking biocViews validity...
* Checking for recommended biocViews...
* Checking build system compatibility...
* Checking for blank lines in DESCRIPTION...
* Checking if DESCRIPTION is well formatted...
* Checking for proper Description: field...
    * WARNING: Description field in the DESCRIPTION file is too concise
* Checking for whitespace in DESCRIPTION field names...
* Checking that Package field matches directory/tarball name...
* Checking for Version field...
* Checking for valid maintainer...
* Checking DESCRIPTION/NAMESPACE consistency...
* Checking vignette directory...
    This is a software package
* Checking library calls...
Error in file(con, "r") : cannot open the connection
Calls: <Anonymous> -> parseFiles -> parseFile
Execution halted
Error: Process completed with exit code 1.

@mtmorgan mtmorgan removed their assignment Mar 2, 2021
@LiNk-NY
Copy link
Contributor

LiNk-NY commented Mar 19, 2021

See #121

@mblue9
Copy link

mblue9 commented Apr 16, 2021

Thanks @LiNk-NY for the PR! I've just been trying it out and it works well locally for me, have tested with BiocCheck 1.27.9 and 1.27.13.

One thing though is it fails with GitHub Actions. here https://github.com/stemangiola/tidybulk/runs/2356663732?check_suite_focus=true#step:24:379

Warning in file(con, "r") :
  cannot open file '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpTqLgjW/file212e1707a88a/tidybulk/inst/doc/../man/fragments/intro.Rmd': No such file or directory
Quitting from lines 16-16 (/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpTqLgjW/file212e1707a88a/tidybulk/inst/doc/../man/fragments/intro.Rmd) 
Error: Error in file(con, "r") : cannot open the connection
Calls: <Anonymous> ... lapply -> FUN -> knit -> <Anonymous> -> readLines -> file
Execution halted
Error: Process completed with exit code 1.

The R CMD Check passes fine, it's just the BiocCheck. I think it's because our child is in man/fragments (so we can share content with the readme) and not vignettes? I know this may be outside your scope as it does work locally but was wondering if you know if there any way to allow the child to be in e.g. man/fragments like R CMD Check so that it'll work with Github actions and BiocCheck?

@LiNk-NY
Copy link
Contributor

LiNk-NY commented Apr 19, 2023

It seems to be a separate issue. Please open a new one with a minimally reproducible example. It may not be in the scope of BiocCheck.

@LiNk-NY LiNk-NY closed this as completed Apr 19, 2023
@stemangiola
Copy link

@multimeric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants