Skip to content

Releases: yutannihilation/savvy

v0.7.0 (2024-10-20)

20 Oct 22:05
Compare
Choose a tag to compare

Release Notes

Breaking Change

Removed TryFrom<Sexp> for usize, so the following code no longer compiles.

#[savvy]
fn foo(x: usize) -> savvy::Result<()> {
    ...
}

Instead, you can use i32 and convert it to usize by yourself. If you are
sure the input number is never negative, you can just use the as conversion.
If you are not sure, you should use <usize>::try_from() and handle the error
by yourself. Also, please be aware you need to handle NA as well.

#[savvy]
fn foo(x: i32) -> savvy::Result<()> {
    if x.is_na() {
        return Err("cannot convert NA to usize".into())?;
    }
    
    let x = <usize>::try_from(x).map_err(|e| e.to_string().into());

    ...
}

Alternatively, you can use newly-added methods, NumericScalar::as_usize() and
NumericSexp::iter_usize(). What's good is that this can handle integer-ish
numeric, which means you can allow users to input a larger number than the
integer max (2147483647)!

fn usize_to_string_scalar(x: NumericScalar) -> savvy::Result<Sexp> {
    let x_usize = x.as_usize()?;
    x_usize.to_string().try_into()
}
usize_to_string_scalar(2147483648)
#> [1] "2147483648"

Install savvy-cli 0.7.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yutannihilation/savvy/releases/download/v0.7.0/savvy-cli-installer.sh | sh

Download savvy-cli 0.7.0

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.8 (2024-09-17)

17 Sep 14:20
Compare
Choose a tag to compare

Release Notes

Minor Improvements

  • savvy init now generates
    • slightly better configure script that checks if cargo command is available
    • cleanup script to remove the generated Makevars after compilation
    • configure.win and cleanup.win
    • src/Makevars.win.in instead of src/Makevars.win for consistency with Unix-alikes

Install savvy-cli 0.6.8

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yutannihilation/savvy/releases/download/v0.6.8/savvy-cli-installer.sh | sh

Download savvy-cli 0.6.8

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.7 (2024-09-05)

05 Sep 13:14
Compare
Choose a tag to compare

Release Notes

Minor Improvements

  • Remove the use of non-API call Rf_findVarInFrame.

  • Now the GitHub release includes an installation script to install the savvy
    CLI into $CARGO_HOME/bin, thanks to cargo-dist. This should make it easier
    to use savvy-cli on CI.

    curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yutannihilation/savvy/releases/download/v0.6.7/savvy-cli-installer.sh | sh
  • Improve handling of raw identifiers (e.g. r#struct) more.

Install savvy-cli 0.6.7

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yutannihilation/savvy/releases/download/v0.6.7/savvy-cli-installer.sh | sh

Download savvy-cli 0.6.7

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

Version 0.6.7-beta.1

04 Sep 09:17
Compare
Choose a tag to compare
Version 0.6.7-beta.1 Pre-release
Pre-release

Release Notes

Install savvy-cli 0.6.7-beta.1

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yutannihilation/savvy/releases/download/v0.6.7-beta.1/savvy-cli-installer.sh | sh

Download savvy-cli 0.6.7-beta.1

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.6 (2024-09-04)

04 Sep 03:20
Compare
Choose a tag to compare

Release Notes

Bug fixes

  • Fix inappropriate use of PROTECT. Thanks @t-kalinowski!

  • Handle raw identifiers (e.g. r#struct) correctly.

Download savvy-cli 0.6.6

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.5 (2024-07-02)

02 Jul 05:55
Compare
Choose a tag to compare

Release Notes

New features

  • Add support for raw, including ALTRAW.
    Please be aware that, while this support was added for consistency, I bet it's
    really rare that a raw vector is actually needed; if you want to deal with a
    binary data on Rust's side, your primary option should be to store it in an
    external pointer (of a struct you define) rather than an R's raw vector.

Minor Improvements

  • Wrapper environment of a Rust struct or enum now cannot be modified by users.

  • Remove the use of the following non-API calls:

    • Rf_findVarInFrame3
    • STRING_PTR
    • DATAPTR

Download savvy-cli 0.6.5

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.4 (2024-05-25)

25 May 08:47
Compare
Choose a tag to compare

Release Notes

New features

  • New function r_warn() safely show a warning. Note that, a warning can raise
    error when options(warn = 2), so you should not ignore the error from
    r_warn(). The error should be propagated to the R session.

  • Savvy now translates Option<T> as an optional argument, i.e., an argument
    with the default value of NULL.

    Example:

    #[savvy]
    fn default_value_vec(x: Option<IntegerSexp>) -> savvy::Result<Sexp> {
        if let Some(x) = x {
            x.iter().sum::<i32>().try_into()
        } else {
            (-1).try_into()
        }
    }
    default_value_vec(1:10)
    #> [1] 55
    
    default_value_vec()
    #> [1] -1

Bug fixes

  • r_print!() and r_eprint!() now can print strings containing %.

Breaking Change

  • The notation for savvy-cli test is now changed to #[cfg(feature = "savvy-test")] from #[cfg(savvy_test)]. This is to avoid the upcoming
    change in Cargo (ref).

Download savvy-cli 0.6.4

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.3 (2024-05-05)

05 May 13:47
Compare
Choose a tag to compare

Release Notes

New features

  • New types NumericSexp and NumericScalar are added to handle both integer
    and double. You can get a slice via as_slice_*() or an iterator via
    iter_*().

    #[savvy]
    fn times_two(x: NumericSexp) -> savvy::Result<Sexp> {
        let mut out = OwnedIntegerSexp::new(x.len())?;
    
        for (i, v) in x.iter_i32().enumerate() {
            let v = v?; // The item of iter_i32() is Result because the conversion can fail.
            if v.is_na() {
                out[i] = i32::na();
            } else {
                out[i] = v * 2;
            }
        }
    
        out.into()
    }

    You can also use .into_typed() to handle integer and double differently.

    #[savvy]
    fn times_two(x: NumericSexp) -> savvy::Result<savvy::Sexp> {
        match x.into_typed() {
            NumericTypedSexp::Integer(i) => times_two_int(i),
            NumericTypedSexp::Real(r) => times_two_real(r),
        }
    }
  • Savvy now provides r_stdout() and r_stderr() to be used with interfaces
    that require std::io::Write. Also, you can use savvy::log::env_logger() to
    output logs to R's stderr. Here's an example usage:

    use savvy::savvy_init;
    use savvy_ffi::DllInfo;
    
    #[savvy_init]
    fn init_logger(dll_info: *mut DllInfo) -> savvy::Result<()> {
        savvy::log::env_logger().init();
        Ok(())
    }

Breaking changes

  • AltList now loses names argument in into_altrep() for consistency.
    Please use set_names() on the resulted Sexp object.

    let mut out = v.into_altrep()?;
    out.set_names(["one", "two"])?;
    Ok(out)

Download savvy-cli 0.6.3

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.2 (2024-05-04)

04 May 03:37
Compare
Choose a tag to compare

Release Notes

New features

  • New macro #[savvy_init] makes the function executed when the DLL is loaded
    by R. This is useful for initializaing resources. See the guide for more details.

    Example:

    use std::sync::OnceLock;
    
    static GLOBAL_FOO: OnceLock<Foo> = OnceLock::new();
    
    #[savvy_init]
    fn init_global_foo(dll_info: *mut DllInfo) -> savvy::Result<()> {
        GLOBAL_FOO.get_or_init(|| Foo::new());
    
        Ok(())
    }
  • Savvy now experimentally supports ALTREP. See the guide for more details.

    Example:

    struct MyAltInt(Vec<i32>);
    
    impl MyAltInt {
        fn new(x: Vec<i32>) -> Self {
            Self(x)
        }
    }
    
    impl savvy::IntoExtPtrSexp for MyAltInt {}
    
    impl AltInteger for MyAltInt {
        const CLASS_NAME: &'static str = "MyAltInt";
        const PACKAGE_NAME: &'static str = "TestPackage";
    
        fn length(&mut self) -> usize {
            self.0.len()
        }
    
        fn elt(&mut self, i: usize) -> i32 {
            self.0[i]
        }
    }

Download savvy-cli 0.6.2

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum

v0.6.1 (2024-04-26)

26 Apr 00:57
Compare
Choose a tag to compare

Release Notes

Minor improvements

  • Now savvy no longer uses SETLENGTH, which is a so-called "non-API" thing.

Download savvy-cli 0.6.1

File Platform Checksum
savvy-cli-aarch64-apple-darwin.tar.xz Apple Silicon macOS checksum
savvy-cli-x86_64-apple-darwin.tar.xz Intel macOS checksum
savvy-cli-x86_64-pc-windows-msvc.zip x64 Windows checksum
savvy-cli-aarch64-unknown-linux-gnu.tar.xz ARM64 Linux checksum
savvy-cli-x86_64-unknown-linux-gnu.tar.xz x64 Linux checksum