Skip to content

Commit c78be81

Browse files
Add notes about recipes for R packages (#4335)
* Add notes about recipes for R packages Co-authored-by: Isabel Paredes <isabel.paredes@quantstack.net> * Improve documentaton of packaging R packages by incorporating suggestions from Isabel Paredes. --------- Co-authored-by: Isabel Paredes <isabel.paredes@quantstack.net>
1 parent 21361db commit c78be81

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/development/adding_packages.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,39 @@ requirements:
144144
* [cryptography](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography)
145145
* [pydantic-core](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography)
146146
* [pycrdt](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pycrdt)
147+
148+
## R Packages
149+
150+
For a package without dependencies of other R packages, only these requirements are usually necessary:
151+
152+
```yaml
153+
requirements:
154+
build:
155+
- cross-r-base_${{ target_platform }}
156+
- ${{ compiler("c") }}
157+
```
158+
159+
Some R packages use the [Rcpp] package for a seamless integration of R and C++. [Rcpp] and all other R-dependencies must be in all 3 `requirements` sections (`build`, `host`, and `run`). For example,
160+
161+
```yaml
162+
requirements:
163+
build:
164+
- cross-r-base_${{ target_platform }}
165+
- ${{ compiler("c") }}
166+
- r-rcpp
167+
host:
168+
- r-rcpp
169+
run:
170+
- r-rcpp
171+
```
172+
173+
There needs to be 2 urls because very frequently the first one is not reachable.
174+
175+
For the tests, we only check that the shared library for the package exists. Eventually we should be able to load the package and do actual tests, but that's not available yet.
176+
177+
**Example recipes**:
178+
179+
* [r-yaml](https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/r-yaml/)
180+
* [r-plyr](https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/r-plyr/)
181+
182+
[Rcpp]: https://cran.r-project.org/web/packages/Rcpp/index.html

0 commit comments

Comments
 (0)