Rhino 1.4.0 Update on CRAN: Streamlined Dependency Management and React Support
We are pleased to announce that Rhino 1.4 is now available on CRAN! This update simplifies dependency management in your project, allows you to integrate React seamlessly into your app, and resolves some issues with {box} modules. Read on to learn more!
<h2>Simplified Dependency Management</h2>
Rhino relies on {renv} for managing R package dependencies in your project. Our setup ensures that your dependencies are:
<ol><li style="font-weight: 400;" aria-level="1">Explicit: Your direct dependencies must be listed in the dependencies.R file.</li><li style="font-weight: 400;" aria-level="1">Reproducible: The lockfile saves the exact package versions and sources of all your direct and transitive dependencies.</li><li style="font-weight: 400;" aria-level="1">Isolated: Your project has its own library, separate from packages installed in other projects or globally.</li></ol>
While these benefits are valuable, they come with some associated costs. Until now, you had to handle the bookkeeping manually. Adding or removing dependencies required three separate steps: updating dependencies.R, the lockfile, and the library.
Rhino 1.4 introduces two new functions: <code>pkg_install()</code> and <code>pkg_remove()</code>. These functions allow you to install a new package, update one to the latest version, or remove a package from your project - all in one step.
For quick examples, refer to the <a href="https://appsilon.github.io/rhino/reference/dependencies.html" target="_blank" rel="noopener">function reference</a>. If you're interested in understanding the inner workings of our setup, we encourage you to explore our <a href="https://appsilon.github.io/rhino/articles/explanation/renv-configuration.html" target="_blank" rel="noopener">Explanation: Renv Configuration</a>.
<h2>Support for React</h2>
React is a widely popular JavaScript library for building web interfaces, and we have invested significant effort to make it possible to use React and its associated UI toolkits in Shiny.
Our work so far includes:
<ol><li style="font-weight: 400;" aria-level="1"><a href="https://appsilon.github.io/shiny.fluent/" target="_blank" rel="noopener">{shiny.fluent}</a>, a wrapper for Fluent UI, a UI toolkit from Microsoft.</li><li style="font-weight: 400;" aria-level="1"><a href="https://appsilon.github.io/shiny.blueprint/" target="_blank" rel="noopener">{shiny.blueprint}</a>, a wrapper for Blueprint, a UI toolkit from Palantir.</li><li style="font-weight: 400;" aria-level="1"><a href="https://appsilon.github.io/shiny.gosling/" target="_blank" rel="noopener">{shiny.gosling}</a>, a wrapper for Gosling, a toolkit for genomics data visualization.</li><li style="font-weight: 400;" aria-level="1"><a href="https://appsilon.github.io/shiny.molstar/" target="_blank" rel="noopener">{shiny.molstar}</a>, a wrapper for Mol*, a toolkit for molecular data visualization.</li></ol>
All of this has been made possible through our <a href="https://appsilon.github.io/shiny.react/" target="_blank" rel="noopener">{shiny.react}</a> package, which provides the necessary functionality to seamlessly integrate React with Shiny. However, up until now, its use was limited to creating R package wrappers for JavaScript libraries.
With Rhino 1.4, you can now define React components directly in your application and effortlessly integrate them into your R code. After adding shiny.react to your project, you can achieve this in three simple steps:
<ol><li style="font-weight: 400;" aria-level="1">Define the component using JSX, a syntax extension for JavaScript.</li><li style="font-weight: 400;" aria-level="1">Declare the component in R.</li><li style="font-weight: 400;" aria-level="1">Use the component in your application.</li></ol>
For detailed instructions, refer to our <a href="https://appsilon.github.io/rhino/articles/tutorial/use-react-in-rhino.html" target="_blank" rel="noopener">Tutorial: Use React in Rhino</a>.
<h2>Improved Box Modules</h2>
Encapsulation and modularization are at the core of Rhino's philosophy. To provide you with a modern import system, we rely on the {box} package, which offers features such as custom file and directory structure for your code, explicit import/export statements, module caching, and more.
With Rhino 1.4, we now require box v1.3.1 or later, as it addresses some issues present in earlier versions. The improvements include:
<ol><li style="font-weight: 400;" aria-level="1">Lazy-loaded data: You can now import data in the same way as other objects, using syntax like box::use(rhino[rhinos]), without the need for rhino::rhinos.</li><li style="font-weight: 400;" aria-level="1">Trailing commas: Trailing commas will no longer cause issues when using reexports or when calling functions accessed via $.</li></ol>
To gain a deeper understanding of {box} in the context of Rhino, we invite you to explore our <a href="https://appsilon.github.io/rhino/articles/explanation/box-modules.html" target="_blank" rel="noopener">Explanation: Box Modules</a>.
<h2>Thorough Verification</h2>
Testing a package like Rhino poses challenges due to its nature, as it heavily relies on system tools, specific project structure, and requires network and filesystem access. Writing unit tests for many parts of the codebase can be impractical.
However, ensuring the correctness of our package and performing proper verification are of utmost importance to us. To address this, we now employ comprehensive end-to-end tests internally. These tests automatically verify all functionalities of Rhino, providing us with the confidence we need in the package's reliability.
<h2>How to get Rhino 1.4?</h2>
To begin a new project with Rhino 1.4, simply run <code>install.packages("rhino")</code> to install the latest version from CRAN. If you already have an existing Rhino project, you can update it by following these steps:
<ol><li>Run <code>renv::update("rhino")</code> to update the Rhino package.</li><li>Run <code>renv::snapshot()</code> to update the lockfile.</li></ol>