GithubHelp home page GithubHelp logo

alexxnica / jupyter-sphinx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jupyter/jupyter-sphinx

0.0 2.0 0.0 10 KB

Sphinx extension for rendering of Jupyter interactive widgets.

License: Other

Python 100.00%

jupyter-sphinx's Introduction

Jupyter Sphinx Extensions

Jupyter Sphinx extensions enable jupyter-specific features in sphinx.

Installation

With pip:

pip install jupyter_sphinx

with conda:

conda install jupyter_sphinx -c conda-forge

Render Jupyter Interactive Widgets jupyter_sphinx.embed_widgets

This extension provides a means of inserting live-rendered Jupyter interactive widgets within sphinx documentation.

It is derived from the altair sphinx extension, which is distributed under the terms of the BSD 3-Clause license.

Enabling the extension

To enable this extension, add jupyter_sphinx.embed_widgets to your enabled extensions in conf.py.

Directives

Two directives are provided: ipywidgets-setup and ipywidgets-display.

ipywidgets-setup code is used to set-up various options prior to running the display code. For example:

.. ipywidgets-setup::

	from ipywidgets import VBox, jsdlink, IntSlider, Button

.. ipywidgets-display::

    s1, s2 = IntSlider(max=200, value=100), IntSlider(value=40)
	b = Button(icon='legal')
	jsdlink((s1, 'value'), (s2, 'max'))
	VBox([s1, s2, b])

In the case of the ipywidgets-display code, if the last statement of the code-block returns a widget object, it will be rendered.

Options

The directives have the following options:

.. ipywidgets-setup::
    :show: # if set, then show the setup code as a code block

    from ipywidgets import Button

.. ipywidgets-display::
    :hide-code:   # if set, then hide the code and only show the widget
    :code-below:  # if set, then code is below rather than above the widget
    :alt: text    # alternate text when widget cannot be rendered

    Button()

Misc.

  • For the widgets to be succesfuly rendered, this extension requires an internet connection, since it depends on a cdn-distributed JavaScript.
  • Widgets rendered on the same page use the same widget manager. As a consequence, they can be linked with each other via JavaScript link widgets. However, no kernel is connect and therefore, interaction with the backend will not happen.

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

All code is licensed under the terms of the revised BSD license.

jupyter-sphinx's People

Contributors

carreau avatar sylvaincorlay avatar willingc avatar

Watchers

 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.