extendr

extendr: Frictionless bindings for R and Rust - Published in JOSS (2024)

https://github.com/extendr/extendr

Science Score: 100.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 31 committers (6.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

api-wrapper extension ffi-bindings r rust

Keywords from Contributors

mesh
Last synced: 4 months ago · JSON representation ·

Repository

R extension library for rust designed to be familiar to R users.

Basic Info
  • Host: GitHub
  • Owner: extendr
  • License: mit
  • Language: Rust
  • Default Branch: master
  • Homepage: https://extendr.github.io
  • Size: 94.9 MB
Statistics
  • Stars: 488
  • Watchers: 13
  • Forks: 50
  • Open Issues: 138
  • Releases: 4
Topics
api-wrapper extension ffi-bindings r rust
Created over 5 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md

extendr - A safe and user friendly R extension interface using Rust

Github Actions Build Status Crates.io Documentation License: MIT DOI

Logo

Welcome

extendR is a suite of software packages, see the website extendR for an overview.

This repository is for the rust crates that are part of extendR, see also {rextendr} for the R-package that facilitates using extendR.

A complete user guide detailing how to use extendR is available here.

The main crate extendr-api is published on crates.io.

Getting started

There are many ways to use extendR from R. In an interactive R session one may use rextendr::rust_function and friends to quickly prototype Rust code.

In an R package context, one may use rextendr::use_extendr() to setup a Rust powered R-package. See also vignette on R-packages.

It is also possible to inline Rust code in RMarkdown/knitr, see vignette on extendr knitr-engine.

See rextendr package for more information on the available functionality from an R session.

Overview

It is intended to be easier to use than the C interface and Rcpp as Rust gives type safety and freedom from segfaults.

The following code illustrates a simple structure trait which is written in Rust. The data is defined in the struct declaration and the methods in the impl.

```rust use extendr_api::prelude::*;

[extendr]

struct Person { pub name: String, }

[extendr]

impl Person { fn new() -> Self { Self { name: "".to_string() } }

fn set_name(&mut self, name: &str) {
    self.name = name.to_string();
}

fn name(&self) -> &str {
    self.name.as_str()
}

}

[extendr]

fn aux_func() { }

// Macro to generate exports extendrmodule! { mod classes; impl Person; fn auxfunc; } ```

The #[extendr] attribute causes the compiler to generate wrapper and registration functions for R which are called when the package is loaded.

The extendr_module! macro lists the module name and exported functions and interfaces.

This library aims to provide an interface that will be familiar to first-time users of Rust or indeed any compiled language.

Goals of the project

Instead of wrapping R objects, we convert to Rust native objects on entry to a function. This makes the wrapped code clean and dependency free. The ultimate goal is to allow the wrapping of existing Rust libraries without markup, but in the meantime, the markup is as light as possible.

```rust

[extendr]

pub fn my_sum(v: &[f64]) -> f64 { v.iter().sum() } ```

You can interact in more detail with R objects using the Robj type which wraps the native R object type. This supports a large subset of the R internals functions, but wrapped to prevent accidental segfaults and failures.

Contributing

We are happy about any contributions!

To get started you can take a look at our Github issues.

You can also get in contact via our Discord server!

Development

The documentation for the latest development version of extendr-api is available here: https://extendr.github.io/extendr/extendr_api/

Owner

  • Name: Extendr
  • Login: extendr
  • Kind: organization

Extension libraries for R in Rust

JOSS Publication

extendr: Frictionless bindings for R and Rust
Published
July 01, 2024
Volume 9, Issue 99, Page 6394
Authors
Mossa Merhi Reimert ORCID
Section for Animal Welfare and Disease Control, Department of Veterinary and Animal Sciences, University of Copenhagen, Denmark
Josiah D. Parry ORCID
Environmental Systems Research Institute (Esri), Redlands, CA, USA
Matt Denwood ORCID
Section for Animal Welfare and Disease Control, Department of Veterinary and Animal Sciences, University of Copenhagen, Denmark
Maya Katrin Gussmann ORCID
Section for Animal Welfare and Disease Control, Department of Veterinary and Animal Sciences, University of Copenhagen, Denmark
Claus O. Wilke ORCID
Department of Integrative Biology, The University of Texas at Austin, Austin, TX, USA
Ilia Kosenkov ORCID
Independent researcher, Finland
Michael Milton ORCID
Walter and Eliza Hall Institute of Medical Research, Australia
Amy Thomason ORCID
Atomic Increment Ltd., United Kingdom
Editor
Mehmet Hakan Satman ORCID
Tags
FFI bindings

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: Reimert
  given-names: Mossa Merhi
  orcid: "https://orcid.org/0009-0007-9297-1523"
- family-names: Parry
  given-names: Josiah D.
  orcid: "https://orcid.org/0000-0001-9910-865X"
- family-names: Denwood
  given-names: Matt
  orcid: "https://orcid.org/0000-0001-5212-4273"
- family-names: Gussmann
  given-names: Maya Katrin
  orcid: "https://orcid.org/0000-0001-5634-5903"
- family-names: Wilke
  given-names: Claus O.
  orcid: "https://orcid.org/0000-0002-7470-9261"
- family-names: Kosenkov
  given-names: Ilia
  orcid: "https://orcid.org/0000-0001-5563-7840"
- family-names: Milton
  given-names: Michael
  orcid: "https://orcid.org/0000-0002-8965-2595"
- family-names: Thomason
  given-names: Amy
  orcid: "https://orcid.org/0000-0001-8240-1614"
doi: 10.5281/zenodo.12584076
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: Reimert
    given-names: Mossa Merhi
    orcid: "https://orcid.org/0009-0007-9297-1523"
  - family-names: Parry
    given-names: Josiah D.
    orcid: "https://orcid.org/0000-0001-9910-865X"
  - family-names: Denwood
    given-names: Matt
    orcid: "https://orcid.org/0000-0001-5212-4273"
  - family-names: Gussmann
    given-names: Maya Katrin
    orcid: "https://orcid.org/0000-0001-5634-5903"
  - family-names: Wilke
    given-names: Claus O.
    orcid: "https://orcid.org/0000-0002-7470-9261"
  - family-names: Kosenkov
    given-names: Ilia
    orcid: "https://orcid.org/0000-0001-5563-7840"
  - family-names: Milton
    given-names: Michael
    orcid: "https://orcid.org/0000-0002-8965-2595"
  - family-names: Thomason
    given-names: Amy
    orcid: "https://orcid.org/0000-0001-8240-1614"
  date-published: 2024-07-01
  doi: 10.21105/joss.06394
  issn: 2475-9066
  issue: 99
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 6394
  title: "extendr: Frictionless bindings for R and Rust"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.06394"
  volume: 9
title: "extendr: Frictionless bindings for R and Rust"

GitHub Events

Total
  • Create event: 42
  • Release event: 1
  • Issues event: 56
  • Watch event: 50
  • Delete event: 38
  • Issue comment event: 139
  • Push event: 153
  • Pull request event: 100
  • Pull request review event: 87
  • Pull request review comment event: 78
  • Fork event: 6
Last Year
  • Create event: 42
  • Release event: 1
  • Issues event: 56
  • Watch event: 50
  • Delete event: 38
  • Issue comment event: 139
  • Push event: 153
  • Pull request event: 100
  • Pull request review event: 87
  • Pull request review comment event: 78
  • Fork event: 6

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 583
  • Total Committers: 31
  • Avg Commits per committer: 18.806
  • Development Distribution Score (DDS): 0.631
Past Year
  • Commits: 34
  • Committers: 8
  • Avg Commits per committer: 4.25
  • Development Distribution Score (DDS): 0.471
Top Committers
Name Email Commits
andy-thomason a****y@a****m 215
CGMossa c****a@g****m 108
Hiroaki Yutani y****i@g****m 92
Ilia Kosenkov i****v@o****m 49
Claus Wilke w****e@a****u 21
Maximilian Goisser g****4@g****m 18
Josiah Parry j****y@g****m 13
dependabot[bot] 4****] 10
Michael Milton m****n@g****m 9
andy-thomason a****y@a****m 6
Daniel Falbel d****l@g****m 6
Søren Havelund Welling s****l@g****m 5
Thomas Down t****s@t****k 5
eitsupi 5****i 4
brendanrbrown 2****n 2
Wenjie Sun s****e@g****m 2
Lucius Hu l****n 2
Eric Burden e****n@g****m 2
Andrés Felipe Quintero Moreano a****o@g****m 2
Xianying Tan s****n@1****m 1
Brancen Gregory b****y@g****m 1
Daniel Tinoco 0****s 1
David B. Dahl d****l@s****u 1
Freddy Drennan d****y@g****m 1
Justin Landis 3****s 1
Nicholas Parker n****k@n****m 1
Pierre Donat-Bouillud p****e 1
Seth s****k@g****m 1
Stanislav Pozdniakov 7****e 1
bicarlsen c****i@g****m 1
and 1 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 179
  • Total pull requests: 391
  • Average time to close issues: 10 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 28
  • Total pull request authors: 26
  • Average comments per issue: 4.34
  • Average comments per pull request: 3.12
  • Merged pull requests: 234
  • Bot issues: 0
  • Bot pull requests: 36
Past Year
  • Issues: 30
  • Pull requests: 106
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 17 days
  • Issue authors: 9
  • Pull request authors: 12
  • Average comments per issue: 0.7
  • Average comments per pull request: 1.49
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 20
Top Authors
Issue Authors
  • JosiahParry (47)
  • yutannihilation (23)
  • multimeric (18)
  • CGMossa (16)
  • eitsupi (8)
  • Ilia-Kosenkov (8)
  • latot (6)
  • andy-thomason (6)
  • clauswilke (5)
  • andyquinterom (4)
  • bicarlsen (3)
  • daniellga (3)
  • Yunuuuu (2)
  • jonlachmann (2)
  • avhz (2)
Pull Request Authors
  • CGMossa (274)
  • dependabot[bot] (46)
  • Ilia-Kosenkov (45)
  • JosiahParry (39)
  • yutannihilation (29)
  • andy-thomason (15)
  • sorhawell (7)
  • eitsupi (7)
  • multimeric (7)
  • jtlandis (6)
  • andyquinterom (6)
  • wenjie1991 (4)
  • brancengregory (4)
  • latot (4)
  • albersonmiranda (3)
Top Labels
Issue Labels
bug (5) enhancement (3) documentation (3) Achitecture (2) good first issue (2) os-Windows (2) question (2) feature-ndarray (1) tests (1)
Pull Request Labels
dependencies (46) rust (42) help wanted (5) github_actions (4) feature-ndarray (3) CI (2) invalid (1) tests (1) feature-either (1) Achitecture (1) documentation (1) enhancement (1) bug (1)

Packages

  • Total packages: 7
  • Total downloads:
    • cargo 475,388 total
  • Total docker downloads: 51
  • Total dependent packages: 14
    (may contain duplicates)
  • Total dependent repositories: 33
    (may contain duplicates)
  • Total versions: 51
  • Total maintainers: 7
crates.io: extendr-api

Safe and user friendly bindings to the R programming language.

  • Versions: 20
  • Dependent Packages: 3
  • Dependent Repositories: 11
  • Downloads: 180,827 Total
  • Docker Downloads: 17
Rankings
Dependent repos count: 7.6%
Downloads: 8.1%
Average: 8.8%
Stargazers count: 8.9%
Dependent packages count: 9.2%
Forks count: 10.3%
Last synced: 4 months ago
crates.io: extendr-macros

Generate bindings from R to Rust.

  • Versions: 17
  • Dependent Packages: 1
  • Dependent Repositories: 11
  • Downloads: 176,998 Total
  • Docker Downloads: 17
Rankings
Dependent repos count: 7.6%
Downloads: 8.1%
Stargazers count: 8.9%
Forks count: 10.3%
Average: 10.6%
Dependent packages count: 18.2%
Last synced: 4 months ago
crates.io: extendr-engine

Safe and user friendly bindings to the R programming language.

  • Versions: 9
  • Dependent Packages: 1
  • Dependent Repositories: 11
  • Downloads: 70,169 Total
  • Docker Downloads: 17
Rankings
Dependent repos count: 7.6%
Downloads: 8.4%
Stargazers count: 8.9%
Forks count: 10.3%
Average: 10.7%
Dependent packages count: 18.2%
Last synced: 4 months ago
crates.io: aorist_extendr-engine

Fork of extendr-engine for aorist project. Safe and user friendly bindings to the R programming language.

  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 0
  • Downloads: 5,154 Total
Rankings
Dependent packages count: 6.9%
Stargazers count: 9.3%
Forks count: 10.5%
Average: 17.6%
Dependent repos count: 29.3%
Downloads: 31.9%
Maintainers (1)
Last synced: 4 months ago
crates.io: aorist_extendr-api

Fork of extendr-api for aorist project. Safe and user friendly bindings to the R programming language.

  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 0
  • Downloads: 4,698 Total
Rankings
Dependent packages count: 6.9%
Stargazers count: 9.3%
Forks count: 10.5%
Average: 18.0%
Dependent repos count: 29.3%
Downloads: 34.0%
Maintainers (1)
Last synced: 4 months ago
crates.io: aorist_extendr-macros

Fork of extendr-macros for aorist project. Safe and user friendly bindings to the R programming language.

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 5,129 Total
Rankings
Stargazers count: 9.3%
Forks count: 10.5%
Dependent packages count: 17.0%
Average: 19.7%
Dependent repos count: 29.3%
Downloads: 32.4%
Maintainers (1)
Last synced: 4 months ago
crates.io: extendr-ffi

Barebone bindings to `libR` for use in extendr.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 32,413 Total
Rankings
Dependent repos count: 22.3%
Dependent packages count: 29.5%
Average: 49.1%
Downloads: 95.6%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/docs.yml actions
  • actions/checkout v4 composite
  • dtolnay/rust-toolchain master composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/msrv.yml actions
  • actions/checkout v4 composite
  • baptiste0928/cargo-install v2 composite
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • dtolnay/install master composite
  • dtolnay/rust-toolchain master composite
  • msys2/setup-msys2 v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
Cargo.toml cargo
extendr-api/Cargo.toml cargo
  • extendr-engine 0.4.0 development
  • rstest 0.18.1 development
  • either 1.8.1
  • extendr-macros 0.4.0
  • libc 0.2
  • ndarray 0.15.3
  • num-complex 0.4
  • once_cell 1
  • paste 1.0.5
  • serde 1.0
extendr-engine/Cargo.toml cargo
extendr-macros/Cargo.toml cargo
  • proc-macro2 1.0
  • quote 1.0.6
  • syn 1.0.22
tests/extendrtests/src/rust/Cargo.toml cargo
tests/extendrtests/DESCRIPTION cran
  • rextendr * imports
  • brio * suggests
  • lobstr * suggests
  • patrick * suggests
  • processx * suggests
  • rmarkdown * suggests
  • rprojroot * suggests
  • stringi * suggests
  • testthat * suggests
  • vctrs * suggests