From 6e990d21dc3db2500ec0eb49e998c21e8e940db8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 17:29:33 +0000 Subject: [PATCH 01/11] Initial plan From 2acc971cabd1f80192b2d0a3ab21f30110e21c54 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 17:31:49 +0000 Subject: [PATCH 02/11] Add PR CI workflow for R CMD check --- .github/workflows/R-CMD-check.yaml | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..cf6c700 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,76 @@ +name: R-CMD-check + +on: + pull_request: + branches: + - master + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (R ${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - os: windows-latest + r: release + - os: macos-latest + r: release + - os: ubuntu-latest + r: release + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + use-public-rspm: true + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Create animl_env and install animl-py + shell: bash + run: | + VENV_DIR="$HOME/.virtualenvs/animl_env" + python -m venv "$VENV_DIR" + + if [[ "$RUNNER_OS" == "Windows" ]]; then + PYTHON_BIN="$VENV_DIR/Scripts/python.exe" + else + PYTHON_BIN="$VENV_DIR/bin/python" + fi + + "$PYTHON_BIN" -m pip install --upgrade pip + "$PYTHON_BIN" -m pip install animl-py + + echo "WORKON_HOME=$HOME/.virtualenvs" >> "$GITHUB_ENV" + echo "RETICULATE_PYTHON=$PYTHON_BIN" >> "$GITHUB_ENV" + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_REMOTE_: false + run: | + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results + path: check From 93a5cd06da12f96e4077d527df661a88d9a65f26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 17:32:32 +0000 Subject: [PATCH 03/11] Add minimal token permissions to CI workflow --- .github/workflows/R-CMD-check.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cf6c700..aa5ebc3 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -5,6 +5,9 @@ on: branches: - master +permissions: + contents: read + jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} From 818e0d253d71c52e9ea3de65649864bf4e6aa94b Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 11:02:39 -0700 Subject: [PATCH 04/11] Change pip install from animl-py to animl --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index aa5ebc3..072f3f6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -54,7 +54,7 @@ jobs: fi "$PYTHON_BIN" -m pip install --upgrade pip - "$PYTHON_BIN" -m pip install animl-py + "$PYTHON_BIN" -m pip install animl echo "WORKON_HOME=$HOME/.virtualenvs" >> "$GITHUB_ENV" echo "RETICULATE_PYTHON=$PYTHON_BIN" >> "$GITHUB_ENV" From 96d48d563e512408b45f2e55c649c91337c37238 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 18:15:22 +0000 Subject: [PATCH 05/11] fix: avoid optional dependency checks during package load --- R/install.R | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/R/install.R b/R/install.R index fbd4941..d53e2b7 100644 --- a/R/install.R +++ b/R/install.R @@ -71,8 +71,10 @@ load_animl <- function(envname = "animl_env", msg(sprintf("animl %s successfully loaded.", ANIML_VERSION)) assign("animl_py", animl_py, envir = .animl_internal) } - # 4) Check external dependencies - check_animl_py() + # 4) Check external dependencies when interactive + if (interactive) { + check_animl_py() + } } # animl_env exists but animl-py not installed else { @@ -325,9 +327,18 @@ check_animl_py <- function(){ if(reticulate::py_module_available("animl")){ animl_py <- reticulate::import("animl", delay_load = TRUE) - exif <- animl_py$check_exiftool() - torch_cuda <- animl_py$check_torch_cuda() - torch_onnx <- animl_py$check_onnx_cuda() + exif <- tryCatch( + animl_py$check_exiftool(), + error = function(e) FALSE + ) + torch_cuda <- tryCatch( + animl_py$check_torch_cuda(), + error = function(e) FALSE + ) + torch_onnx <- tryCatch( + animl_py$check_onnx_cuda(), + error = function(e) FALSE + ) if(interactive()){ message(sprintf("Exiftool installed and available: %s", as.character(exif))) From a5ada591a521587852395d20cdad4e009e388ab4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Jul 2026 18:30:14 +0000 Subject: [PATCH 06/11] fix: avoid eager animl import during noninteractive load --- R/install.R | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/R/install.R b/R/install.R index d53e2b7..0bc1959 100644 --- a/R/install.R +++ b/R/install.R @@ -1,6 +1,16 @@ # VARIABLE FOR VERSION ANIML_VERSION <- "3.3.1" +animl_module_installed <- function() { + tryCatch( + { + importlib_util <- reticulate::import("importlib.util") + !is.null(importlib_util$find_spec("animl")) + }, + error = function(e) FALSE + ) +} + #' Load animl-py if available #' #' @param envname name of python environment @@ -55,9 +65,20 @@ load_animl <- function(envname = "animl_env", } # env exists else { + if (!interactive) { + if (animl_module_installed()) { + assign( + "animl_py", + reticulate::import("animl", delay_load = TRUE), + envir = .animl_internal + ) + } + return(invisible()) + } + # check animl-py installed msg("\n2. Checking animl-py version...") - if (reticulate::py_module_available("animl")) { + if (animl_module_installed()) { animl_py <- reticulate::import("animl", delay_load = TRUE) animl_py_version <- animl_py$'__version__' @@ -324,7 +345,7 @@ animl_install_instructions <- function() { #' #' @export check_animl_py <- function(){ - if(reticulate::py_module_available("animl")){ + if(animl_module_installed()){ animl_py <- reticulate::import("animl", delay_load = TRUE) exif <- tryCatch( From 2c5ddd59d98f0bcdf3ab8da2eb70df7705e89939 Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 11:56:37 -0700 Subject: [PATCH 07/11] Add '--no-tests' option to rcmdcheck --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 072f3f6..7e94033 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -68,7 +68,7 @@ jobs: env: _R_CHECK_CRAN_INCOMING_REMOTE_: false run: | - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran" "--no-tests"), error_on = "warning", check_dir = "check") shell: Rscript {0} - name: Upload check results From edd51152f6b2ff5fe20a7f86c49aec54066af66a Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 12:06:02 -0700 Subject: [PATCH 08/11] Fix syntax error in R CMD check command --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7e94033..a9242b2 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -68,7 +68,7 @@ jobs: env: _R_CHECK_CRAN_INCOMING_REMOTE_: false run: | - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran" "--no-tests"), error_on = "warning", check_dir = "check") + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-tests"), error_on = "warning", check_dir = "check") shell: Rscript {0} - name: Upload check results From 97ec6fcb034c85cf78bbdf8d30f18d66ac781f61 Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 12:15:58 -0700 Subject: [PATCH 09/11] Set ONNXRUNTIME_LOGLEVEL to 4 in R CMD check --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a9242b2..9df8d82 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -67,6 +67,7 @@ jobs: - name: Check env: _R_CHECK_CRAN_INCOMING_REMOTE_: false + ONNXRUNTIME_LOGLEVEL: 4 run: | rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-tests"), error_on = "warning", check_dir = "check") shell: Rscript {0} From 887295629c85626dbbbb592ae47b91dfdae2503a Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 12:47:02 -0700 Subject: [PATCH 10/11] Change R version to 4.6.1 in CI workflow Updated R version in workflow matrix to 4.6.1 for all OS. --- .github/workflows/R-CMD-check.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9df8d82..9dc9b0e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,12 +18,9 @@ jobs: fail-fast: false matrix: config: - - os: windows-latest - r: release - - os: macos-latest - r: release - - os: ubuntu-latest - r: release + - {os: windows-latest, r: '4.6.1'} + - {os: macOS-latest, r: '4.6.1'} + - {os: ubuntu-latest, r: '4.6.1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} From 4dc1a05597ead4e06617298ce46defaa399ece15 Mon Sep 17 00:00:00 2001 From: Kyra Swanson Date: Fri, 31 Jul 2026 12:48:10 -0700 Subject: [PATCH 11/11] Add 'dev' branch to pull request triggers --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9dc9b0e..61ff1dd 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - dev permissions: contents: read