widget-gen

0.8.1 • Public • Published

widget-gen

Npm version Travis build status codecov

This is a utility library for auto-generating jupyter widget definitions based on the synchronization state. Any bussiness logic will have to be added on top, but this utility can help with:

  • Bootstrapping development
  • Keeping the different definitions (kernels + frontend) in sync

The last point is best accomplished by using the auto-generated definitions as base classes for the classes that actually add the business logic.

It can read (parse) widget definitions from:

  • A custom JSON schema-like format
  • Python widgets based on ipywidgets

And then output corresponding code in the following languages:

  • Python
  • ES5 Javascript
  • ES6 Javascript
  • Typescript

Installation

npm install [-g] widget-gen

Usage

> widgetgen --help
  Usage: main [options] <file> [languages...]
 
  Options:
 
    -V, --version                output the version number
    -p, --parser [parser]        The name of the parser to use, either "json" or "python".
    -o, --outputdir [outputdir]  The output directory.
    -t, --template [template]    a template file to use.
    -e, --extension [extension]  The file extension to use for the output.
    -h, --help                   output usage information

Extending language support

To add support for other output languages, you need to add another Writer class. You can either do this by inherting the base Writer class, having full control of the process, or you can inherit the TemplateWriter class that will use Nunjucks templates for creating output.

Package Sidebar

Install

npm i widget-gen

Weekly Downloads

3

Version

0.8.1

License

BSD-3-Clause

Unpacked Size

210 kB

Total Files

110

Last publish

Collaborators

  • vidartf