diff --git a/.Rbuildignore b/.Rbuildignore index f62a415..6a79e04 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,4 @@ +^auto$ .*\.Rproj$ ^\.Rproj\.user$ ^README.Rmd diff --git a/.github/workflows/rworkflows.yml b/.github/workflows/rworkflows.yml index 0c2d138..cb7c71e 100644 --- a/.github/workflows/rworkflows.yml +++ b/.github/workflows/rworkflows.yml @@ -4,14 +4,19 @@ name: rworkflows branches: - master - main + - devel - RELEASE_** pull_request: branches: - master - main + - devel - RELEASE_** jobs: rworkflows: + permissions: + contents: write + packages: write runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (${{ matrix.config.r }}) container: ${{ matrix.config.cont }} @@ -20,16 +25,22 @@ jobs: matrix: config: - os: ubuntu-latest - r: devel bioc: devel - cont: bioconductor/bioconductor_docker:devel - rspm: https://packagemanager.rstudio.com/cran/__linux__/focal/release + r: auto + cont: ghcr.io/bioconductor/bioconductor_docker:devel + python: 3.11 - os: macOS-latest - r: latest bioc: release + r: auto + cont: ~ + rspm: ~ + python: 3.11 - os: windows-latest - r: latest bioc: release + r: auto + cont: ~ + rspm: ~ + python: 3.11 steps: - uses: neurogenomics/rworkflows@master with: @@ -41,10 +52,9 @@ jobs: run_covr: ${{ true }} run_pkgdown: ${{ true }} has_runit: ${{ false }} - GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} - run_docker: ${{ true }} - docker_user: bschilder - docker_org: neurogenomicslab + has_latex: ${{ false }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run_docker: ${{ false }} DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} runner_os: ${{ runner.os }} - cache_version: cache-master + cache_version: cache-v1 diff --git a/.gitignore b/.gitignore index 9aa76e2..c5a9972 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +auto/ basilisk/ # R project files *.Rproj @@ -40,4 +41,4 @@ vignettes/*.R *.utf8.md *.knit.md # R Environment Variables -.Renviron \ No newline at end of file +.Renviron diff --git a/DESCRIPTION b/DESCRIPTION index ef929d7..412722c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: echoconda Type: Package Title: echoverse module: conda environment management -Version: 0.99.9 +Version: 0.99.10 Authors@R: c(person(given = "Brian", family = "Schilder", @@ -59,7 +59,7 @@ Suggests: Remotes: github::MRCIEU/genetics.binaRies, github::RajLabMSSM/echodata -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 StagedInstall: no VignetteBuilder: knitr License: GPL (>= 3) diff --git a/NEWS.md b/NEWS.md index 547a2bb..743f8aa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# echoconda 0.99.10 + +## New features + +* Updated `rworkflows`. + # echoconda 0.99.9 ## New features diff --git a/R/basilisk.R b/R/basilisk.R index 31a6758..64fcfb5 100644 --- a/R/basilisk.R +++ b/R/basilisk.R @@ -22,11 +22,14 @@ create_env_basilisk <- function(yaml_path, pkgs, sep="=", use_subversion=FALSE, + use_nodefaults=TRUE, start = TRUE){ package <- NULL; # yaml_path <- tail(ymls$yaml_path,1) yaml_txt <- yaml::read_yaml(file = yaml_path) deps <- unlist(yaml_txt$dependencies) + #### Omit python #### + deps <- deps[!startsWith(deps,"python")] #### Check for pip deps #### has_pip <- if(!is.null(names(deps))){ startsWith(names(deps),"pip") @@ -41,7 +44,7 @@ create_env_basilisk <- function(yaml_path, } #### Subset to only core packages #### #### Make sure package aren't listed twice #### - pkgs <- pkgs[!duplicated(pkgs$package),] + pkgs <- pkgs[!duplicated(pkgs$package),] #### Omit subversions for increased flexibility #### if(isFALSE(use_subversion)){ pkgs$version <- stringr::str_split(pkgs$version,"[.]", @@ -50,15 +53,18 @@ create_env_basilisk <- function(yaml_path, ## Split by pip / non-pip pip_pkgs <- pkgs[package %in% unname(deps[has_pip]),] nonpip_pkgs <- pkgs[package %in% unname(deps[!has_pip]),] + channels <- unique(c(pkgs$channel, + if(use_nodefaults) "nodefaults" else NULL)) + use_nodefaults #### Create basilisk env object #### envObj <- basilisk::BasiliskEnvironment( envname = yaml_txt$name, pkgname = "echoconda", ## Use >= rather than = or == for increased flexibility, ## but reduced reproducibility. - packages = paste(nonpip_pkgs$package,nonpip_pkgs$version,sep=sep), - pip = paste(pip_pkgs$package,pip_pkgs$version,sep=sep), - channels = unique(c(pkgs$channel,"nodefaults")) + packages = paste(nonpip_pkgs$package, nonpip_pkgs$version, sep=sep), + pip = paste(pip_pkgs$package, pip_pkgs$version, sep=sep), + channels = channels ) if(isTRUE(start)){ proc <- basilisk::basiliskStart(env = envObj) diff --git a/R/create_env.R b/R/create_env.R index 92b275a..2448bac 100644 --- a/R/create_env.R +++ b/R/create_env.R @@ -1,6 +1,13 @@ #' Create conda env #' #' Create conda env using one of several methods. +#' @param ... Additional arguments passed to method-specific +#' conda env build functions: +#' \itemize{ +#' \item \code{basilisk}: \link[echoconda]{create_env_basilisk} +#' \item \code{reticulate}: \link[reticulate]{conda_create} +#' \item \code{cli}: \link[echoconda]{create_env_cli} +#' } #' @keywords internal #' @inheritParams yaml_to_env #' @inheritParams reticulate::conda_create @@ -9,7 +16,8 @@ create_env <- function(conda_env, method=c("basilisk","reticulate","cli"), conda="auto", force_new=FALSE, - verbose=TRUE){ + verbose=TRUE, + ...){ messager("echoconda:: Creating conda environment:", conda_env, v = verbose ) @@ -26,7 +34,8 @@ create_env <- function(conda_env, if(method=="reticulate"){ reticulate::conda_create(envname = conda_env, environment = yaml_path, - conda = conda) + conda = conda, + ...) #### basilisk #### } else if(method=="basilisk"){ pkgs <- data.table::fread( @@ -35,7 +44,7 @@ create_env <- function(conda_env, ) envObj <- create_env_basilisk(yaml_path = yaml_path, pkgs = pkgs, - start = TRUE) + ...) conda_env <- envObj@envname #### cli #### @@ -43,7 +52,8 @@ create_env <- function(conda_env, conda_env <- create_env_cli(yaml_path = yaml_path, conda = conda, force_new = force_new, - verbose = verbose) + verbose = verbose, + ...) } else { stp <- paste("method must be one of:", paste("\n -",eval(formals(create_env)$method))) diff --git a/R/env_to_yaml.R b/R/env_to_yaml.R index 67f64a1..f1fac39 100644 --- a/R/env_to_yaml.R +++ b/R/env_to_yaml.R @@ -16,11 +16,11 @@ #' @export #' @importFrom reticulate conda_export #' @examples -#' path <- echoconda::env_to_yaml(conda_env="base") +#' path <- env_to_yaml(conda_env="base") env_to_yaml <- function(conda_env, yaml_path = file.path(tempdir(),"conda.yml"), conda = "auto", - method = c("basilisk","reticulate"), + method = c("reticulate","basilisk"), verbose = TRUE, ...){ diff --git a/R/find_env_rlib.R b/R/find_env_rlib.R index 8b3350c..02827c0 100644 --- a/R/find_env_rlib.R +++ b/R/find_env_rlib.R @@ -5,10 +5,12 @@ #' #' @family conda #' @export -find_env_rlib <- function(conda_env = "echoR", +find_env_rlib <- function(conda_env = "echoR_mini", suffix = "lib/R/library/") { conda_env <- check_env(conda_env = conda_env) - conda_path <- dirname(dirname(find_python_path(conda_env = conda_env))) + list.files(conda_env) + python <- find_python_path(conda_env = conda_env) + conda_path <- dirname(dirname(python)) if (conda_path == ".") { env_Rlib <- .libPaths() message("No conda_env='", conda_env, "' not found.") diff --git a/R/install_conda_basilisk.R b/R/install_conda_basilisk.R index 4931ef6..6cbe00f 100644 --- a/R/install_conda_basilisk.R +++ b/R/install_conda_basilisk.R @@ -6,8 +6,8 @@ #' @keywords internal #' @importFrom basilisk.utils installConda install_conda_basilisk <- function(verbose=TRUE){ - - new_install <- basilisk.utils::installConda() + # Sys.setenv("BASILISK_USE_SYSTEM_DIR"=1) + new_install <- basilisk.utils::installConda(installed = FALSE) if(isTRUE(new_install)){ messager("echoconda:: Installing conda via basilisk.",v=verbose) } else { diff --git a/R/yaml_to_env.R b/R/yaml_to_env.R index 535e523..2420be5 100644 --- a/R/yaml_to_env.R +++ b/R/yaml_to_env.R @@ -14,17 +14,19 @@ #' overwrite it with a new one (\emph{DEFAULT}: \code{FALSE}). #' @param show_contents Show the contents of the yaml file (if used). #' @param verbose Print messages. +#' @inheritParams create_env #' @inheritParams reticulate::conda_create #' #' @source \href{https://github.com/rstudio/reticulate/issues/779}{GitHub Issue} #' @source \href{https://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t}{ #' StackOverflow suggestions for cross-platform troubleshooting} #' @family conda +#' #' @export #' @importFrom reticulate conda_binary #' @importFrom echodata is_local is_url #' @examples -#' conda_env <- echoconda::yaml_to_env() +#' conda_env <- yaml_to_env() yaml_to_env <- function(yaml_path = system.file( package = "echoconda", "conda","echoR_mini.yml" @@ -33,13 +35,13 @@ yaml_to_env <- function(yaml_path = system.file( conda = "auto", force_new = FALSE, show_contents = FALSE, - verbose = TRUE) { - # echoverseTemplate:::source_all() - # echoverseTemplate:::args2vars(echoconda::yaml_to_env) + verbose = TRUE, + ...) { + # devoptera::args2vars(yaml_to_env) method <- tolower(method)[1] - install_conda(method = method, - verbose = verbose) + # install_conda(method = method, + # verbose = verbose) start <- Sys.time() #### Check whether env exists #### conda_env <- name_from_yaml(yaml_path = yaml_path, @@ -87,7 +89,8 @@ yaml_to_env <- function(yaml_path = system.file( method = method, conda = conda, force_new = force_new, - verbose = verbose) + verbose = verbose, + ...) } } conda_env <- check_env(conda_env = conda_env) diff --git a/README.Rmd b/README.Rmd index ea896ac..4255ed3 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,12 +1,6 @@ --- title: "" -author: "

- `r badger::badge_github_version(color = 'black')` - `r badger::badge_github_actions(action = 'rworkflows')` - `r badger::badge_last_commit()` - `r badger::badge_codecov()` - `r badger::badge_license()` -
Author: Brian M. Schilder
" +author: "`r rworkflows::use_badges(branch='main')`" date: "
README updated: `r format( Sys.Date(), '%b-%d-%Y')`
" output: github_document @@ -14,12 +8,14 @@ output: ```{r, echo=FALSE, include=FALSE} pkg <- read.dcf("DESCRIPTION", fields = "Package")[1] -description <- read.dcf("DESCRIPTION", fields = "Description")[1] +description <- read.dcf("DESCRIPTION", fields = "Description")[1] |> + gsub(pattern="\n",replacement=" ") ``` ## ``r pkg``: `r gsub("echoverse module: ","", description)` -This R package is part of the *echoverse* suite that supports [`echolocatoR`](https://github.com/RajLabMSSM/echolocatoR): +This R package is part of the *echoverse* suite that supports +[`echolocatoR`](https://github.com/RajLabMSSM/echolocatoR): an automated genomic fine-mapping pipeline. If you use ``r pkg``, please cite: diff --git a/README.md b/README.md index 7e6ad28..8a67f27 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,22 @@ -

-[![](https://img.shields.io/badge/devel%20version-0.99.9-black.svg)](https://github.com/RajLabMSSM/echoconda) -[![R build -status](https://github.com/RajLabMSSM/echoconda/workflows/rworkflows/badge.svg)](https://github.com/RajLabMSSM/echoconda/actions) -[![](https://img.shields.io/github/last-commit/RajLabMSSM/echoconda.svg)](https://github.com/RajLabMSSM/echoconda/commits/main) -[![](https://app.codecov.io/gh/RajLabMSSM/echoconda/branch/main/graph/badge.svg)](https://app.codecov.io/gh/RajLabMSSM/echoconda) +
[![License: GPL (\>= 3)](https://img.shields.io/badge/license-GPL%20(%3E=%203)-blue.svg)](https://cran.r-project.org/web/licenses/GPL%20(%3E=%203)) -¶
¶ Author: Brian M. Schilder
-
¶ README updated: Dec-22-2022
- -## `echoconda`: Various utility functions to find, build, - -and use conda environments from within R. +[![](https://img.shields.io/badge/devel%20version-0.99.10-black.svg)](https://github.com/RajLabMSSM/echoconda) +[![](https://img.shields.io/github/languages/code-size/RajLabMSSM/echoconda.svg)](https://github.com/RajLabMSSM/echoconda) +[![](https://img.shields.io/github/last-commit/RajLabMSSM/echoconda.svg)](https://github.com/RajLabMSSM/echoconda/commits/main) +
[![R build +status](https://github.com/RajLabMSSM/echoconda/workflows/rworkflows/badge.svg)](https://github.com/RajLabMSSM/echoconda/actions) +[![](https://codecov.io/gh/RajLabMSSM/echoconda/branch/main/graph/badge.svg)](https://app.codecov.io/gh/RajLabMSSM/echoconda) +
+ +

+Authors: Brian Schilder, Jack Humphrey, Towfique Raj +

+
+README updated: Feb-11-2024 +
+ +## `echoconda`: Various utility functions to find, build, and use conda environments from within R. This R package is part of the *echoverse* suite that supports [`echolocatoR`](https://github.com/RajLabMSSM/echolocatoR): an automated diff --git a/inst/conda/ontogpt.yml b/inst/conda/ontogpt.yml new file mode 100644 index 0000000..3414ea0 --- /dev/null +++ b/inst/conda/ontogpt.yml @@ -0,0 +1,10 @@ +name: ontogpt +channels: + - conda-forge + - bioconda + - nodefaults +dependencies: + - python>=3.9 + - poetry + - pip: + - ontogpt diff --git a/inst/conda/plotly.yml b/inst/conda/plotly.yml new file mode 100644 index 0000000..2ead8b7 --- /dev/null +++ b/inst/conda/plotly.yml @@ -0,0 +1,13 @@ +name: plotly +channels: + - conda-forge + - bioconda + - plotly + - nodefaults +dependencies: + - python>=3.7 + - plotly + - plotly-orca + - python-kaleido + - r-plotly + - pip diff --git a/inst/conda/pumap.yml b/inst/conda/pumap.yml new file mode 100644 index 0000000..bee0755 --- /dev/null +++ b/inst/conda/pumap.yml @@ -0,0 +1,16 @@ +name: pumap +channels: + - conda-forge + - plotly + - nodefaults +dependencies: + - pytorch + - torchvision + - torchaudio + - seaborn + - ipykernel + - plotly + - nbformat + - pip + - pip: + - umap-pytorch diff --git a/inst/conda/pytorch.yml b/inst/conda/pytorch.yml new file mode 100644 index 0000000..2506e7c --- /dev/null +++ b/inst/conda/pytorch.yml @@ -0,0 +1,24 @@ +name: pytorch +channels: + - conda-forge + - pytorch + - rapidsai +dependencies: + - python + - numpy + - matplotlib + - scikit-learn + - pytorch>=1.4 + - torchvision>=0.5 + - torchtext + - tensorboard + - opencv + - librosa + - rapids + - nb_conda_kernels + - jupyter + - jupyterlab + - jupyter-server-proxy + - pip + - pip: + - torchviz diff --git a/inst/conda/scanpy.yml b/inst/conda/scanpy.yml index 84afac1..8231eaa 100644 --- a/inst/conda/scanpy.yml +++ b/inst/conda/scanpy.yml @@ -10,10 +10,12 @@ dependencies: - scikit-learn - statsmodels - numba + - tensorflow + - tensorflow-probability - pytables - python-igraph - leidenalg - - louvain + # - louvain - scanpy - anndata - bbknn @@ -23,7 +25,8 @@ dependencies: - matplotlib - seaborn - plotly - - chart-studio + - ipykernel + - nbformat - glob2 # Jupyter # - jupyter @@ -36,3 +39,5 @@ dependencies: - pip: - magic-impute - scarches + - keras-nlp + - tensorflow-metal # Enable GPU on Mac diff --git a/inst/conda/scgpt.yml b/inst/conda/scgpt.yml new file mode 100644 index 0000000..0d5bd1c --- /dev/null +++ b/inst/conda/scgpt.yml @@ -0,0 +1,12 @@ +name: scgpt +channels: + - conda-forge + - plotly + - nodefaults +dependencies: + - ipykernel + - plotly + - nbformat + - pip + - pip: + - umap-pytorch diff --git a/inst/conda/scvi.yml b/inst/conda/scvi.yml new file mode 100644 index 0000000..d4d9102 --- /dev/null +++ b/inst/conda/scvi.yml @@ -0,0 +1,26 @@ +name: scvi +channels: + - conda-forge + - plotly + - pytorch + #- nvidia + - nodefaults +dependencies: + - pydantic<2.0 + #- pytorch + #- torchvision + #- torchaudio + #- pytorch-cuda=11.7 + #- jax + #- jaxlib + - scvi-tools + - scanpy + - anndata + - fastcluster + - leidenalg + - python-igraph + - seaborn + - plotly + - ipykernel + - nbformat + - pip diff --git a/inst/conda/tensorflow_metal.yml b/inst/conda/tensorflow_metal.yml new file mode 100644 index 0000000..cf2dc84 --- /dev/null +++ b/inst/conda/tensorflow_metal.yml @@ -0,0 +1,18 @@ +name: tensorflow_metal +channels: + - conda-forge + - plotly + - nodefaults +dependencies: + - tensorflow=="2.14" + - tensorflow-probability + - umap-learn + - matplotlib + - seaborn + - ipykernel + - plotly + - nbformat + - pip + - pip: + ## tf-metal versions only work with specific tf versions: https://pypi.org/project/tensorflow-metal/ + - tensorflow-metal=="1.1.0" # for mac GPU access diff --git a/inst/conda/uce.yml b/inst/conda/uce.yml new file mode 100644 index 0000000..5fe5273 --- /dev/null +++ b/inst/conda/uce.yml @@ -0,0 +1,18 @@ +name: uce +channels: + - conda-forge + - plotly + - pytorch + - nodefaults +dependencies: + - numpy + - scipy + - pandas + - tqdm + - pytorch + - scanpy + - accelerate + - requests + - urllib3==1.26.6 + - ipykernel + - pip diff --git a/inst/conda/ukb.yml b/inst/conda/ukb.yml index 2d935fd..ca82b4d 100644 --- a/inst/conda/ukb.yml +++ b/inst/conda/ukb.yml @@ -9,25 +9,12 @@ dependencies: - python>=3.6.1 - pandas - openpyxl - - matplotlib - - seaborn + - plotly - fastcluster - mygene - scikit-learn - - umap-learn - - chart-studio + - umap-learn - pip - # Jupyter - - jupyter - # nbconvert >=6.0 causes problems - - nbconvert=5.6.1 - - nb_conda_kernels - - jupyter_contrib_nbextensions - ## After install jupyter_contrib_nbextensions, run: jupyter nbextensions_configurator enable --user - - nodejs - ## bokehheat installation instructions: https://docs.bokeh.org/en/latest/docs/user_guide/jupyter.html#userguide-jupyter - ## After install nodejs: jupyter labextension install @jupyter-widgets/jupyterlab-manager - ## And: jupyter labextension install @bokeh/jupyter_bokeh - pip: - bokehheat - gene-outlier-detection diff --git a/inst/conda/vep.yml b/inst/conda/vep.yml new file mode 100644 index 0000000..8f9f146 --- /dev/null +++ b/inst/conda/vep.yml @@ -0,0 +1,7 @@ +name: vep +channels: + - conda-forge + - bioconda + - nodefaults +dependencies: + - ensembl-vep diff --git a/man/create_env.Rd b/man/create_env.Rd index 310cb5d..3c307ca 100644 --- a/man/create_env.Rd +++ b/man/create_env.Rd @@ -10,7 +10,8 @@ create_env( method = c("basilisk", "reticulate", "cli"), conda = "auto", force_new = FALSE, - verbose = TRUE + verbose = TRUE, + ... ) } \arguments{ @@ -32,6 +33,14 @@ See \strong{Finding Conda} and \code{\link[reticulate:conda_binary]{conda_binary overwrite it with a new one (\emph{DEFAULT}: \code{FALSE}).} \item{verbose}{Print messages.} + +\item{...}{Additional arguments passed to method-specific +conda env build functions: +\itemize{ + \item \code{basilisk}: \link[echoconda]{create_env_basilisk} + \item \code{reticulate}: \link[reticulate]{conda_create} + \item \code{cli}: \link[echoconda]{create_env_cli} + }} } \description{ Create conda env using one of several methods. diff --git a/man/create_env_basilisk.Rd b/man/create_env_basilisk.Rd index 701e481..953751d 100644 --- a/man/create_env_basilisk.Rd +++ b/man/create_env_basilisk.Rd @@ -14,6 +14,7 @@ create_env_basilisk( pkgs, sep = "=", use_subversion = FALSE, + use_nodefaults = TRUE, start = TRUE ) } diff --git a/man/env_to_yaml.Rd b/man/env_to_yaml.Rd index f9e49f9..7dfed97 100644 --- a/man/env_to_yaml.Rd +++ b/man/env_to_yaml.Rd @@ -15,7 +15,7 @@ env_to_yaml( conda_env, yaml_path = file.path(tempdir(), "conda.yml"), conda = "auto", - method = c("basilisk", "reticulate"), + method = c("reticulate", "basilisk"), verbose = TRUE, ... ) @@ -43,7 +43,7 @@ See \strong{Finding Conda} and \code{\link[reticulate:conda_binary]{conda_binary Export a yaml file from a conda environment. } \examples{ -path <- echoconda::env_to_yaml(conda_env="base") +path <- env_to_yaml(conda_env="base") } \seealso{ Other conda: diff --git a/man/find_env_rlib.Rd b/man/find_env_rlib.Rd index 9b82e95..6c757c6 100644 --- a/man/find_env_rlib.Rd +++ b/man/find_env_rlib.Rd @@ -4,7 +4,7 @@ \alias{find_env_rlib} \title{Find the R library for a specific env} \usage{ -find_env_rlib(conda_env = "echoR", suffix = "lib/R/library/") +find_env_rlib(conda_env = "echoR_mini", suffix = "lib/R/library/") } \arguments{ \item{conda_env}{Conda environment name.} diff --git a/man/yaml_to_env.Rd b/man/yaml_to_env.Rd index 6a6903b..9e4b16a 100644 --- a/man/yaml_to_env.Rd +++ b/man/yaml_to_env.Rd @@ -16,7 +16,8 @@ yaml_to_env( conda = "auto", force_new = FALSE, show_contents = FALSE, - verbose = TRUE + verbose = TRUE, + ... ) } \arguments{ @@ -40,13 +41,21 @@ overwrite it with a new one (\emph{DEFAULT}: \code{FALSE}).} \item{show_contents}{Show the contents of the yaml file (if used).} \item{verbose}{Print messages.} + +\item{...}{Additional arguments passed to method-specific +conda env build functions: +\itemize{ + \item \code{basilisk}: \link[echoconda]{create_env_basilisk} + \item \code{reticulate}: \link[reticulate]{conda_create} + \item \code{cli}: \link[echoconda]{create_env_cli} + }} } \description{ Create a conda environment from a yaml file. By default, creates the "echoR" conda env to support \pkg{echolocatoR}. } \examples{ -conda_env <- echoconda::yaml_to_env() +conda_env <- yaml_to_env() } \seealso{ Other conda: diff --git a/tests/testthat/test-env_to_yaml.R b/tests/testthat/test-env_to_yaml.R index ed38f2c..9bd40e5 100644 --- a/tests/testthat/test-env_to_yaml.R +++ b/tests/testthat/test-env_to_yaml.R @@ -1,18 +1,19 @@ test_that("env_to_yaml works", { #### base #### - path_base <- echoconda::env_to_yaml(conda_env="base") + path_base <- env_to_yaml(conda_env="base") l_base <- readLines(path_base) # testthat::expect_gte(length(l_base), 400) echoconda:::messager(length(l_base),"lines in exported env yaml:","base") - utils::head(l_base) + # utils::head(l_base) testthat::expect_equal(echoconda:::name_from_yaml(path_base),"base") #### echoR_mini #### - path_echor <- echoconda::env_to_yaml(conda_env="echoR_mini") + conda_env <- yaml_to_env() + path_echor <- env_to_yaml(conda_env="echoR_mini") l_echor <- readLines(path_echor) # testthat::expect_gte(length(l_echor), 400) echoconda:::messager(length(l_echor),"lines in exported env yaml:","echoR_mini") - utils::head(l_echor) + # utils::head(l_echor) testthat::expect_equal(echoconda:::name_from_yaml(path_echor),"echoR_mini") }) diff --git a/tests/testthat/test-find_env_rlib.R b/tests/testthat/test-find_env_rlib.R index 919176b..945cc55 100644 --- a/tests/testthat/test-find_env_rlib.R +++ b/tests/testthat/test-find_env_rlib.R @@ -1,13 +1,11 @@ test_that("find_env_rlib works", { - conda_env <- echoconda::yaml_to_env(yaml_path = system.file( - package = "echoconda", - "conda/echoR.yml" - )) + conda_env <- yaml_to_env() - env_Rlib <- find_env_rlib(conda_env = "echoR") - testthat::expect_type(env_Rlib, "character") + env_Rlib <- find_env_rlib(conda_env = conda_env) + # testthat::expect_equal(basename(dirname(dirname(dirname(env_Rlib)))), + # "echoR_mini") - env_Rlib <- find_env_rlib(conda_env = NULL) - testthat::expect_type(env_Rlib, "character") + # env_Rlib <- find_env_rlib(conda_env = NULL) + # testthat::expect_true(dir.exists(env_Rlib)) }) diff --git a/tests/testthat/test-find_packages.R b/tests/testthat/test-find_packages.R index 1d93b30..17dbf89 100644 --- a/tests/testthat/test-find_packages.R +++ b/tests/testthat/test-find_packages.R @@ -1,38 +1,38 @@ test_that("find_packages works", { - conda_env <- echoconda::yaml_to_env() + conda_env <- yaml_to_env() #### python packages: default #### - pkgs1 <- echoconda::find_packages(packages = c("pyarrow","pandas"), - conda_env = "echoR_mini", - method = "r") + pkgs1 <- find_packages(packages = c("pyarrow","pandas"), + conda_env = "echoR_mini", + method = "r") testthat::expect_equal(nrow(pkgs1), 0) - pkgs1b <- echoconda::find_packages(packages = c("pyarrow","pandas"), - conda_env = "echoR_mini", - method = "reticulate") + pkgs1b <- find_packages(packages = c("pyarrow","pandas"), + conda_env = "echoR_mini", + method = "reticulate") testthat::expect_equal(nrow(pkgs1b), 2) testthat::expect_equal(pkgs1b$package, sort(c("pyarrow","pandas"))) #### tabix #### - pkgs2 <- echoconda::find_packages(packages = "tabix", - conda_env = "echoR_mini") + pkgs2 <- find_packages(packages = "tabix", + conda_env = "echoR_mini") testthat::expect_equal(nrow(pkgs2), 1) testthat::expect_equal(pkgs2$package, "tabix") #### multiple pkgs in multiple envs #### ## method="reticulate" packages <- c("python","wget","tabix","pandas") - pkgs3 <- echoconda::find_packages(packages = packages, - conda_env = c("base","echoR_mini"), - method="reticulate") + pkgs3 <- find_packages(packages = packages, + conda_env = c("base","echoR_mini"), + method="reticulate") testthat::expect_gte(nrow(pkgs3), 5) testthat::expect_equal(sum(sapply(pkgs3$path, length)==0), 1) testthat::expect_equal(sort(unique(pkgs3$package)), sort(packages)) ## method="r" - pkgs3b <- echoconda:: find_packages(packages = packages, - conda_env = c("base","echoR_mini"), - method="r") + pkgs3b <- find_packages(packages = packages, + conda_env = c("base","echoR_mini"), + method="r") testthat::expect_gte(nrow(pkgs3b), 4) testthat::expect_equal(sum(sapply(pkgs3b$path, length)==0), 0) testthat::expect_equal(sort(unique(pkgs3b$package)),