The scaffolder package provides a comprehensive set of tools to automate the process of scaffolding interfaces to modules, classes, functions, and documentations written in other programming languages. As initial proof of concept, scaffolding R interfaces to Python packages is supported via reticulate.
Let’s say if we want to write an interface to an existing Python package. reticulate package is the perfect tool to facilitate that. reticulate package contains a powerful set of tools for interoperability between Python and R. It allows R users to call Python from R in many different ways and automatically translate between different R and Python objects.
However, if we use reticulate often enough, we will face many challenges, for example:
TRUE, convert Python list literals in the docs to R lists, massage R numeric values to Python integers via
as.integerwhere required, etc.). And then again, this requires future maintenance in order to keep them up-to-date.
The scaffolder package comes to the rescue. It provides functions to automatically scaffold and customize the R wrapper interfaces to modules, classes, functions, and documentations written in other programming languages. Users are able to customize different parts of the scaffolding process in order to avoid the additional editing that we mentioned above. For example, users can implement a function to cast parameters with default values that contains “L” to integers.
The core functionalties of this package were originally developed by J.J. Allaire and Yuan Tang as part of reticulate’s scaffolding functionalities to facilitate the process of writing different components of the R interface to TensorFlow. We found the process of writing R wrappers very tedious and then developed the scaffolding functionalities in reticulate that are marked for internal use only. It was then further developed and experimented to automate the generation of h2oai/h2o4gpu’s R package.