From 968fae73a63fbf792ba3538a5636479ad88f77f3 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 09:22:41 -0300 Subject: [PATCH 1/6] Prepare CRAN release v0.2.0 Bump version to 0.2.0, update maintainer email to dfalbel@gmail.com, and update copyright holder from RStudio to Posit Software, PBC. --- DESCRIPTION | 6 +++--- NEWS.md | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d0a966e..4a812a1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,9 @@ Package: madgrad Title: 'MADGRAD' Method for Stochastic Optimization -Version: 0.1.0.9000 +Version: 0.2.0 Authors@R: c( - person("Daniel", "Falbel", email = "daniel@rstudio.com", role = c("aut", "cre", "cph")), - person(family = "RStudio", role = c("cph")), + person("Daniel", "Falbel", email = "dfalbel@gmail.com", role = c("aut", "cre", "cph")), + person(family = "Posit Software, PBC", role = c("cph")), person(family = "MADGRAD original implementation authors.", role = c("cph")) ) Description: A Momentumized, Adaptive, Dual Averaged Gradient Method for Stochastic diff --git a/NEWS.md b/NEWS.md index e413058..106f390 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# madgrad (development version) +# madgrad 0.2.0 + +* Changed maintainer email address. # madgrad 0.1.0 From 0739bfd210ca9f48d7c424d069d50a1ab4cf8780 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 09:24:37 -0300 Subject: [PATCH 2/6] Modernize CI workflow with r-lib/actions v2 Replace manual dependency caching, system dependency handling, and rcmdcheck scripting with r-lib/actions v2 setup-r-dependencies and check-r-package. Bump all actions to current versions and update Ubuntu runners to latest. --- .github/workflows/main.yml | 58 ++++++++------------------------------ 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8fd8b5..e2655d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,3 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions on: push: branches: @@ -24,62 +22,30 @@ jobs: config: - {os: windows-latest, r: 'release'} - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes TORCH_INSTALL: 1 TORCH_TEST: 1 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - 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} + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + args: 'c("--no-manual", "--as-cran")' From a1250730f791062b4d27b26ff7e342628b8c80f6 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 09:26:13 -0300 Subject: [PATCH 3/6] Add CRAN downloads badge to README --- README.Rmd | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.Rmd b/README.Rmd index 10d513f..f30ffad 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,6 +18,7 @@ knitr::opts_chunk$set( [![R-CMD-check](https://github.com/mlverse/madgrad/workflows/R-CMD-check/badge.svg)](https://github.com/mlverse/madgrad/actions) [![CRAN status](https://www.r-pkg.org/badges/version/madgrad)](https://CRAN.R-project.org/package=madgrad) +[![Downloads](https://cranlogs.r-pkg.org/badges/madgrad)](https://CRAN.R-project.org/package=madgrad) The Madgrad package is an R port of the original [madgrad](https://github.com/facebookresearch/madgrad) by Aaron Defazio and Samy Jelassi. diff --git a/README.md b/README.md index 90f8a4d..7e506f7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ [![R-CMD-check](https://github.com/mlverse/madgrad/workflows/R-CMD-check/badge.svg)](https://github.com/mlverse/madgrad/actions) [![CRAN status](https://www.r-pkg.org/badges/version/madgrad)](https://CRAN.R-project.org/package=madgrad) +[![Downloads](https://cranlogs.r-pkg.org/badges/madgrad)](https://CRAN.R-project.org/package=madgrad) The Madgrad package is an R port of the original From fb155f72ba5aabf54fd373ffc1171611b2986879 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 09:42:05 -0300 Subject: [PATCH 4/6] Add importFrom directives for torch and rlang Fixes R CMD check NOTE about undeclared imports from Imports field. --- DESCRIPTION | 2 +- NAMESPACE | 4 ++++ R/madgrad.R | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4a812a1..808355e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,7 +14,7 @@ Description: A Momentumized, Adaptive, Dual Averaged Gradient Method for Stochas License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.3.3 Imports: torch (>= 0.3.0), rlang diff --git a/NAMESPACE b/NAMESPACE index d4404bd..ce316ab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,7 @@ # Generated by roxygen2: do not edit by hand export(optim_madgrad) +importFrom(rlang,abort) +importFrom(torch,optimizer) +importFrom(torch,torch_is_installed) +importFrom(torch,torch_zeros_like) diff --git a/R/madgrad.R b/R/madgrad.R index 19eba24..9b5cd94 100644 --- a/R/madgrad.R +++ b/R/madgrad.R @@ -36,6 +36,8 @@ #' @returns #' An optimizer object implementing the `step` and `zero_grad` methods. #' +#' @importFrom torch optimizer torch_zeros_like torch_is_installed +#' @importFrom rlang abort #' @export optim_madgrad <- torch::optimizer( initialize = function(params, lr = 1e-2, momentum = 0.9, weight_decay = 0, From cf81bf80e7ec0a9f54549850379c927aa231c4e9 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 10:09:02 -0300 Subject: [PATCH 5/6] Fix CRAN NOTEs: use arXiv DOI and exclude .git from build --- .Rbuildignore | 1 + DESCRIPTION | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.Rbuildignore b/.Rbuildignore index fe00823..a563e74 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,4 @@ ^README\.Rmd$ ^\.github$ ^CRAN-RELEASE$ +^\.git$ diff --git a/DESCRIPTION b/DESCRIPTION index 808355e..417bf53 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,7 +10,7 @@ Description: A Momentumized, Adaptive, Dual Averaged Gradient Method for Stochas Optimization algorithm. MADGRAD is a 'best-of-both-worlds' optimizer with the generalization performance of stochastic gradient descent and at least as fast convergence as that of Adam, often faster. A drop-in optim_madgrad() implementation - is provided based on Defazio et al (2020) . + is provided based on Defazio et al (2020) . License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) From 1d15a45757768439b8625058f450b7bd3b3ded19 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Tue, 28 Apr 2026 10:10:16 -0300 Subject: [PATCH 6/6] Add cran-comments.md for maintainer email change --- .Rbuildignore | 1 + cran-comments.md | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 cran-comments.md diff --git a/.Rbuildignore b/.Rbuildignore index a563e74..28a9ece 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,4 @@ ^\.github$ ^CRAN-RELEASE$ ^\.git$ +^cran-comments\.md$ diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..b3e1e25 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,9 @@ +## R CMD check results + +0 errors | 0 warnings | 0 notes + +## Maintainer change + +The maintainer email has changed from daniel@rstudio.com to dfalbel@gmail.com. +This is the same person (Daniel Falbel). The previous email was a corporate +address that is no longer active.