Bioconductor / Contributions

Contribute Packages to Bioconductor
134 stars 33 forks source link

BiocBook #3118

Closed js2264 closed 11 months ago

js2264 commented 1 year ago

Update the following URL to point to the GitHub repository of the package you wish to submit to Bioconductor

Confirm the following by editing each check box to '[x]'

I am familiar with the essential aspects of Bioconductor software management, including:

For questions/help about the submission process, including questions about the output of the automatic reports generated by the SPB (Single Package Builder), please use the #package-submission channel of our Community Slack. Follow the link on the home page of the Bioconductor website to sign up.

hpages commented 11 months ago

Thanks @js2264 for the changes.

The easiest approach I can think of, in order not to have to download this archive from GitHub, would be to include this template as extdata in BiocBook package itself

Definitely some advantages to this approach:

I can't think of any drawbacks to this approach. The template is small (v1.0.4.tar.gz is 152K) so size is not a concern.

Note that one could argue that a package template is not really data so feel free to put this anywhere under inst/.

The recommendation for a software package is to set the URL field to the canonical URL of its landing page (a.k.a. "Package Short URL"), which will be https://bioconductor.org/packages/BiocBook in the case of BiocBook (the page does not exist yet but it will get automatically created after the package gets added to our daily builds). The BugReports field already points people to the issue tracker on GitHub. Bioconductor prefers to make the package landing page the primary URL, and not advertize the URL of the Github repo too much because this encourages people to install the package from there (which is bad) or to use the issue tracker to ask questions about how to use the software (which is also bad).

Also I would suggest to set the BugReports field to the issue part of the GitHub repo: https://github.com/js2264/BiocBook/issues

Found in BiocBook/README.md:

To install BiocBook development version, you can use:

install.packages("devtools")
devtools::install_github("js2264/BiocBook")

You should still not do this. If you want to install the development version, you first need to make sure that you are using the development version of Bioconductor (depending on the time of the year, this might require installing R devel), then doing BiocManager::install("BiocBook") will bring the development version of BiocBook. As mentioned earlier, installing directly from GitHub has the potential to mess up your installation by introducing version mismatches. In other words, BiocManager::install() is the only safe way to install Bioconductor packages.

Similar problem found in BiocBookDemo/inst/pages/Chapter-2.qmd:

if (!require(BiocBook)) BiocManager::install('js2264/BiocBook')

Not sure why I get the following message when I try to use an existing name:

> init('OSCA', .local = TRUE)
...
! `available` server is currently unavailable. Skipping validation...
...

Also shouldn't this be a hard error? I.e. the function should stop and not create the OSCA folder.

I find the name of the commit argument misleading. IIUC this is about pushing commits, not committing changes. Also the default for commit is NA but the man page says it's FALSE. Furthermore, based on the code, it seems that commit=NA and commit=FALSE don't have the same meaning but the man page does not document the meaning of the former.

Given that the BiocBook man page (?BiocBook) documents more than one function, the \value section should either document them all, or at least clarify which one it refers to. Right now it's up to the user to figure this out:

Value:

     A ‘BiocBook’ object (invisible).

No need to re-implement tempfile(). Instead of:

    tmpdir <- paste0('.', paste0(
        sample(c(seq(0, 9), LETTERS), 8, replace = TRUE), collapse = ""
    ))
    dir.create(tmpdir)

just do something like:

    tmpdir <- tempfile()  # or tempfile("BiocBook.template."), but it does not matter _at all_
    dir.create(tmpdir)

Note that an important feature of tempfile() is that it returns the path to a file that will be created inside tempdir(). This means that the file is guaranteed to get removed at the end of the R session. Right now your code explicitely needs to take care of that (with unlink(tmpdir, recursive = TRUE)). However, if for whatever reason the call to init() dies prematurely, the tmp dir that your code created in the working directory will remain there, hence contaminating the user's folder with a stale hidden subfolder. See ?tempfile for more info.

This seems like a lot of code only to copy the content of one folder to an empty folder:

    ## Move files from temp folder to `new_package` folder
    d <- list.dirs(tmpdir, full.names = TRUE, recursive = TRUE)
    d <- d[dirname(d) != '.']
    pattern <- file.path(tmpdir, basename(d)[dirname(dirname(d)) == '.'])
    d <- d[dirname(dirname(d)) != '.']
    f <- list.files(
        tmpdir, 
        all.files = TRUE, full.names = TRUE, recursive = TRUE
    )
    f <- f[!grepl("archive.zip$", f)]
    for (.d in d) dir.create(gsub(pattern, repo, .d))
    for (.f in f) file.copy(from = .f, to = gsub(pattern, repo, .f))

Is this because the various files that need to be skipped (the *archive.zip files) can be located at any depth in the tempdir tree? Otherwise copying the content can be done with:

    content <- list.files(tmpdir, all.files=TRUE, full.names=TRUE, no..=TRUE)
    file.copy(content, repo, recursive=TRUE)

If the file to skip is located at the top of the tmpdir tree, then add:

    content <- content[!grepl("archive.zip$", content)]

before calling file.copy().

Not sure what the purpose of the invisible(BiocBook(repo)) line is here:

        if (!is.na(commit)) {
            if (commit) {
                gert::git_push(repo = repo)
                cli::cli_alert_success(cli::col_grey("Commits pushed to origin {cli::col_cyan(gert::git_remote_list(repo = repo)$url[1])}"))
            }
            else {
                invisible(BiocBook(repo))
            }
        }
       ...

The if statement is not the last expression in the body of the init() function so the invisible(BiocBook(repo)) line won't return anything. It's just a no-op.

The body of the init() function is very long. Readbility, troubleshooting, and long-term maintainability, could be improved significantly by breaking it down into smaller internal helper functions, one for each major step accomplished by the big function.

Thanks again, H.

bioc-issue-bot commented 11 months ago

Received a valid push on git.bioconductor.org; starting a build for commit id: c6a5fbda6d27ddad2def810f87bd6fdb5d536394

bioc-issue-bot commented 11 months ago

Received a valid push on git.bioconductor.org; starting a build for commit id: 06905d3e8c4c68e418e66c3719e466464e866d2c

bioc-issue-bot commented 11 months ago

Dear Package contributor,

This is the automated single package builder at bioconductor.org.

Your package has been built on the Bioconductor Build System.

On one or more platforms, the build results were: "ERROR, skipped". This may mean there is a problem with the package that you need to fix. Or it may mean that there is a problem with the build system itself.

Please see the build report for more details.

The following are build products from R CMD build on the Bioconductor Build System: Linux (Ubuntu 22.04.2 LTS): BiocBookDemo_0.99.3.tar.gz

Links above active for 21 days.

Remember: if you submitted your package after July 7th, 2020, when making changes to your repository push to git@git.bioconductor.org:packages/BiocBookDemo to trigger a new build. A quick tutorial for setting up remotes and pushing to upstream can be found here.

bioc-issue-bot commented 11 months ago

Dear Package contributor,

This is the automated single package builder at bioconductor.org.

Your package has been built on the Bioconductor Build System.

On one or more platforms, the build results were: "ERROR". This may mean there is a problem with the package that you need to fix. Or it may mean that there is a problem with the build system itself.

Please see the build report for more details.

The following are build products from R CMD build on the Bioconductor Build System: macOS 12.6.5 Monterey: BiocBook_0.99.10.tar.gz Linux (Ubuntu 22.04.2 LTS): BiocBook_0.99.10.tar.gz

Links above active for 21 days.

Remember: if you submitted your package after July 7th, 2020, when making changes to your repository push to git@git.bioconductor.org:packages/BiocBook to trigger a new build. A quick tutorial for setting up remotes and pushing to upstream can be found here.

bioc-issue-bot commented 11 months ago

Received a valid push on git.bioconductor.org; starting a build for commit id: ab7ce5dead5a453cd00841972798b824dacd9cca

bioc-issue-bot commented 11 months ago

Dear Package contributor,

This is the automated single package builder at bioconductor.org.

Your package has been built on the Bioconductor Build System.

Congratulations! The package built without errors or warnings on all platforms.

Please see the build report for more details.

The following are build products from R CMD build on the Bioconductor Build System: Linux (Ubuntu 22.04.2 LTS): BiocBook_0.99.11.tar.gz macOS 12.6.5 Monterey: BiocBook_0.99.11.tar.gz

Links above active for 21 days.

Remember: if you submitted your package after July 7th, 2020, when making changes to your repository push to git@git.bioconductor.org:packages/BiocBook to trigger a new build. A quick tutorial for setting up remotes and pushing to upstream can be found here.

js2264 commented 11 months ago

Thanks @hpages , these comments are super helpful. You'll see my answers below.

You are right that this strategy makes a lot of sense.

Fixed

"To install BiocBook development version, you can use:"

install.packages("devtools")  
devtools::install_github("js2264/BiocBook")  

You should still not do this. If you want to install the development version, you first need to make sure that you are using the development version of Bioconductor (depending on the time of the year, this might require installing R devel), then doing BiocManager::install("BiocBook") will bring the development version of BiocBook. As mentioned earlier, installing directly from GitHub has the potential to mess up your installation by introducing version mismatches. In other words, BiocManager::install() is the only safe way to install Bioconductor packages. Similar problem found in BiocBookDemo/inst/pages/Chapter-2.qmd:

if (!require(BiocBook)) BiocManager::install('js2264/BiocBook')

I see, I didn't realize that the devel version as well should strictly be pointing to Bioconductor. Thanks for clarifying this.

init('OSCA', .local = TRUE) ... ! available server is currently unavailable. Skipping validation... ... Also shouldn't this be a hard error? I.e. the function should stop and not create the OSCA folder.

Thanks for catching this bug, it's now fixed.

I renamed commit boolean argument to push and updated the documentation.

I updated the doc.

I refactored most of this when I embedded the template within the package. I am now using the approach you suggested in your comment, thank you.

I originally had another approach which required me to use this rather convoluted code. But now that I rely on the embedded archive it's much easier, I've used your code, thanks!

It's now fixed.

I've split this super-big function in smaller chunks, thanks for the input.

js2264 commented 11 months ago

@hpages do you think you will have more comments to add to this review? Or do you want me to work more on some of the points already mentionned? I don't want to sound pushy, but it would be super helpful if these packages could be added to the current devel a few days before the release, so that I have some time to check that everything runs ok on the BBS, since BiocBookDemo is slightly different package compared to others. Thanks!

hpages commented 11 months ago

Hi @js2264, thanks for your patience. We've received many last minute package submissions for 3.18 that keep us quite busy.

Thanks again for the many improvements.

One last nitpicking. I was wondering if the following packages actually need to be listed in the Suggests field of BiocBookDemo as I don't see them used anywhere in the package: BiocCheck, rcmdcheck, quarto. For quarto, I see that external command quarto is used, but not the CRAN package quarto. Reliance on the quarto command should be declared with something like SystemRequirements: quarto. Note that this is for BiocBookDemo only. BiocBook depends on CRAN package quarto but doesn't use the quarto command directly, so doesn't need to change anything.

Other than that BiocBook/BiocBookDemo are in good shape and ready to go.

H.

bioc-issue-bot commented 11 months ago

Received a valid push on git.bioconductor.org; starting a build for commit id: 6e12f20bc542f72f233a28647dd1409cab7507f7

bioc-issue-bot commented 11 months ago

Received a valid push on git.bioconductor.org; starting a build for commit id: c9c4b1cd20ebc31e9086968a2af45306c00ebf55

bioc-issue-bot commented 11 months ago

Dear Package contributor,

This is the automated single package builder at bioconductor.org.

Your package has been built on the Bioconductor Build System.

On one or more platforms, the build results were: "skipped, ERROR". This may mean there is a problem with the package that you need to fix. Or it may mean that there is a problem with the build system itself.

Please see the build report for more details.

The following are build products from R CMD build on the Bioconductor Build System: Linux (Ubuntu 22.04.2 LTS): BiocBookDemo_0.99.4.tar.gz

Links above active for 21 days.

Remember: if you submitted your package after July 7th, 2020, when making changes to your repository push to git@git.bioconductor.org:packages/BiocBookDemo to trigger a new build. A quick tutorial for setting up remotes and pushing to upstream can be found here.

bioc-issue-bot commented 11 months ago

Dear Package contributor,

This is the automated single package builder at bioconductor.org.

Your package has been built on the Bioconductor Build System.

Congratulations! The package built without errors or warnings on all platforms.

Please see the build report for more details.

The following are build products from R CMD build on the Bioconductor Build System: macOS 12.6.5 Monterey: BiocBook_0.99.12.tar.gz Linux (Ubuntu 22.04.2 LTS): BiocBook_0.99.12.tar.gz

Links above active for 21 days.

Remember: if you submitted your package after July 7th, 2020, when making changes to your repository push to git@git.bioconductor.org:packages/BiocBook to trigger a new build. A quick tutorial for setting up remotes and pushing to upstream can be found here.

js2264 commented 11 months ago

Thanks for your reply @hpages , and thank you for your time and effort in reviewing this package and others. I've now removed the unnecessary deps from Suggests.

bioc-issue-bot commented 11 months ago

Your package has been accepted. It will be added to the Bioconductor nightly builds.

Thank you for contributing to Bioconductor!

Reviewers for Bioconductor packages are volunteers from the Bioconductor community. If you are interested in becoming a Bioconductor package reviewer, please see Reviewers Expectations.

hpages commented 11 months ago

@lshep 2 packages accepted: BiocBook (software package) and BiocBookDemo (book). Thanks!

lshep commented 11 months ago

The default branch of your GitHub repository has been added to Bioconductor's git repository as branch devel.

To use the git.bioconductor.org repository, we need an 'ssh' key to associate with your github user name. If your GitHub account already has ssh public keys (https://github.com/js2264.keys is not empty), then no further steps are required. Otherwise, do the following:

  1. Add an SSH key to your github account
  2. Submit your SSH key to Bioconductor

See further instructions at

https://bioconductor.org/developers/how-to/git/

for working with this repository. See especially

https://bioconductor.org/developers/how-to/git/new-package-workflow/ https://bioconductor.org/developers/how-to/git/sync-existing-repositories/

to keep your GitHub and Bioconductor repositories in sync.

Your package will be included in the next nigthly 'devel' build (check-out from git at about 6 pm Eastern; build completion around 2pm Eastern the next day) at

https://bioconductor.org/checkResults/

(Builds sometimes fail, so ensure that the date stamps on the main landing page are consistent with the addition of your package). Once the package builds successfully, you package will be available for download in the 'Devel' version of Bioconductor using BiocManager::install("BiocBook"). The package 'landing page' will be created at

https://bioconductor.org/packages/BiocBook

If you have any questions, please contact the bioc-devel mailing list (https://stat.ethz.ch/mailman/listinfo/bioc-devel); this issue will not be monitored further.

lshep commented 11 months ago

The default branch of your GitHub repository has been added to Bioconductor's git repository as branch devel.

To use the git.bioconductor.org repository, we need an 'ssh' key to associate with your github user name. If your GitHub account already has ssh public keys (https://github.com/js2264.keys is not empty), then no further steps are required. Otherwise, do the following:

  1. Add an SSH key to your github account
  2. Submit your SSH key to Bioconductor

See further instructions at

https://bioconductor.org/developers/how-to/git/

for working with this repository. See especially

https://bioconductor.org/developers/how-to/git/new-package-workflow/ https://bioconductor.org/developers/how-to/git/sync-existing-repositories/

to keep your GitHub and Bioconductor repositories in sync.

Your package will be included in the next nigthly 'devel' build (check-out from git at about 6 pm Eastern; build completion around 2pm Eastern the next day) at

https://bioconductor.org/checkResults/

(Builds sometimes fail, so ensure that the date stamps on the main landing page are consistent with the addition of your package). Once the package builds successfully, you package will be available for download in the 'Devel' version of Bioconductor using BiocManager::install("BiocBookDemo"). The package 'landing page' will be created at

https://bioconductor.org/packages/BiocBookDemo

If you have any questions, please contact the bioc-devel mailing list (https://stat.ethz.ch/mailman/listinfo/bioc-devel); this issue will not be monitored further.