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:
npm install [-g] widget-gen
> widgetgen --helpUsage: 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
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
TemplateWriter class that will use Nunjucks templates for creating output.