Arcadia-Science / sourmashconsumr

Working with the outputs of sourmash in R
https://arcadia-science.github.io/sourmashconsumr/
Other
21 stars 3 forks source link

Set up CI and document development environment and how to develop #10

Closed taylorreiter closed 1 year ago

taylorreiter commented 1 year ago

Brought up in #8

taylorreiter commented 1 year ago

And also remove testthat from suggests, because it doesn't really belong in DESCRIPTION I don't think. I like the idea of recording the test env in a conda yml.

taylorreiter commented 1 year ago

jk testthat needs to stay as that's the convention.

taylorreiter commented 1 year ago

CI set up in #24 and #26

taylorreiter commented 1 year ago

developer docs:

The sourmashconsumr package follows package developer conventions laid out in https://r-pkgs.org/. It uses this github repository, the software for R and RStudio, and the R packages devtools, testthat, and usethis for development. It also relies on the packages in the DESCRIPTION file.

Obtaining the sourmashconsumr source code and installing package and development dependencies

Obtaining the source code

Outside arcadia: fork the repo to your own github user account. Clone the repository locally. Inside arcadia: clone and create a branch. Clone the repository locally using git clone.

See section contributing XXX below for instructions on how to contribute code changes back to the sourmashconsumr repository.

Installing R and RStudio

Make sure you have R and RStudio installed.

Opening the sourmashconsumr R project

You'll then need to open the R project for the sourmashconsumer project. You can do this by double clicking the sourmashconsumr.Rproj file in your file finder or by using File -> Open Project... and then finding and opening the sourmashconsumr.Rproj file.

Installing development dependencies

To start developing the package, you'll need to install devtools, testthat, and usethis.

You can use the following commands to install these packages:

install.packages(c("devtools", "testthat", "usethis"))

To run all of the tests, you'll also need all of the dependencies of the package. See the instructions below for options for how to install these dependencies.

Installing the package dependencies

The sourmashconsumr package has a lot of dependencies as it tries to make the outputs of the sourmash python package interoperable with biological computing packages already in the R ecosystem. You can install these dependencies however you like; they're all documented in the DESCRIPTION file in the root of this repository. Below we describe different strategies for installing the dependencies.

Installing package dependencies

The simplest way may be to install from github, which will trigger missing dependencies to be installed.

install.packages("devtools")
devtools::install_github("Arcadia-Science/sourmashconsumr")

Some of the package dependencies are available on Bioconductor (namely phyloseq), so if installation of dependencies fails through install_github, you may have more success using BiocManager:

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("Arcadia-Science/sourmashconsumr")

Managing the development environment with conda

If the above methods fail, conda can be used to install the dependencies.

ADD CONDA INSTALLATION INSTRUCTIONS, MAMBA, ENV YAML FILE, MAMBA ENV CREATE

You'll still need to install RStudio after creating the conda environment. Then, if you're using a mac computer, you can open the sourmashconsumr Rproject by running open sourmashconsumr.Rproj from the activated environment you just created.

open sourmashconsumr.Rproj

Developing

Getting started

library(devtools)
load_all()

Open the file you want to change and make changes.

Tests

The core package functionality is encoded in R scripts in the R folder. Each function has at least one unit test in the tests/testthat/ folder.

Run all tests

test()

Only run tests related to the active file

test_active_file()

Documentation

Vignette

devtools::build_rmd("vignettes/sourmashconsumr.Rmd")

Checking all the things

check()

Contributing changes back to the sourmashconsumr repository

Pull requests

to be continued

taylorreiter commented 1 year ago

Closed by #65