ami (“am I?”) provides a unified collection of lightweight checks that can be used to better understand the environments in which your code is running. This includes different operating systems, Continuous Integration (CI) environments, containers, and more. Similar or identical functions already exist. However, most of these functions exist within highly specialized packages, so using several of them can quickly create a lot of dependencies for your own projects.
You can install the latest released version of ami by running:
install.packages("ami")
If you’d like to try out the development version of ami, you can install directly from GitHub:
# install.packages("remotes")
::install_github("briandconnelly/ami") remotes
::online()
ami#> [1] TRUE
::using_rstudio()
ami#> [1] FALSE
::using_rstudio_dark_theme()
ami#> [1] FALSE
::using_macos() && ami::using_x86_cpu()
ami#> [1] FALSE
::using_docker_container()
ami#> [1] FALSE
::using_ci()
ami#> [1] FALSE
::using_github_actions()
ami#> [1] FALSE
ami can be used to check any environment variable. For example, we can see if we’re running in a Poetry environment:
::using_envvar("POETRY_ACTIVE")
ami#> [1] FALSE
We can also check for package options. Here, we’ll see whether boot is configured to do parallel bootstrapping using multiple cores:
::using_option("boot.parallel", "multicore")
ami#> [1] FALSE
If you’re using options as part of package development, check out the options package.