Giter Club home page Giter Club logo

scaffolder's Introduction

Note: This package has been maintained by @terrytangyuan since 2019. Please consider sponsoring!

scaffolder

CRAN_Status_Badge Lifecycle: experimental

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.

Why do we need this package?

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:

  • We need to copy-paste doc-strings from Python API and then edit it in order to provide API references for the R wrapper functions. This requires a lot of editing and endless maintenance efforts in the future to keep the consistency between the API references in both Python and R.
  • We need to copy-paste the default values for all the parameters and translate Python objects to R objects when writing the R wrapper functions (e.g. None -> NULL, True -> TRUE, convert Python list literals in the docs to R lists, massage R numeric values to Python integers via as.integer where 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.

History

The core functionalties of this package were originally developed 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.

Getting started

Installation

Install the scaffolder package from CRAN as follows:

install.packages("scaffolder")

Or you can install it from GitHub as follows:

install.packages("remotes")
remotes::install_github("terrytangyuan/scaffolder")

Examples

Please checkout the examples here.

scaffolder's People

Contributors

terrytangyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.