Thank you for your interest in contributing to spopt! This document provides instructions for setting up a development environment and building the package from source.
Installation for users
Most users should install pre-built binaries from r-universe:
install.packages("spopt", repos = "https://walkerke.r-universe.dev")The instructions below are for contributors and developers who need to build from source.
Building from source
spopt uses a Rust backend via extendr and the HiGHS solver for mixed-integer programming. Building from source requires several system dependencies.
macOS
-
Install Rust (if not already installed):
-
Install system dependencies via Homebrew:
-
Install the package:
# install.packages("pak") pak::pak("walkerke/spopt-r")
Linux (Ubuntu/Debian)
-
Install Rust:
-
Install system dependencies:
-
Install the package:
pak::pak("walkerke/spopt-r")
Windows
Windows builds are more complex due to toolchain requirements. We strongly recommend using r-universe binaries on Windows.
If you must build from source:
-
Install Rtools44 (or appropriate version for your R):
- Download from https://cran.r-project.org/bin/windows/Rtools/
-
Install Rust using rustup:
- Download from https://rustup.rs/
- During installation, select the
x86_64-pc-windows-gnutoolchain
-
Configure Rust for GNU toolchain:
-
Install additional MSYS2 packages (from Rtools terminal):
-
Install the package:
pak::pak("walkerke/spopt-r")
Development workflow
Running tests
devtools::test()Building the pkgdown site
The vignettes use Quarto. To build the documentation site:
pkgdown::build_site()Reporting issues
Please report bugs and feature requests at https://github.com/walkerke/spopt-r/issues.
When reporting bugs, please include: - Your operating system and version - R version (sessionInfo()) - A minimal reproducible example
