Skip to main content

idom-jupyter

A client for IDOM implemented using Jupyter widgets

Try It Now!

Check out some live examples by clicking the badge below:

Binder

Getting Started

To install use pip:

pip install idom_jupyter

Then, before anything else, do one of the following:

  1. At the top of your notebook run

    import idom_jupyter
    
  2. Register idom_jupyter as a permanant IPython extension in your config file:

    c.InteractiveShellApp.extensions = [
        'idom_jupyter'
    ]
    

Usage

Once you're done getting started, you can author and display IDOM layouts natively in your Jupyter Notebook:

import idom

@idom.component
def ClickCount():
    count, set_count = idom.hooks.use_state(0)
    return idom.html.button(
        {"onClick": lambda event: set_count(count + 1)},
        [f"Click count: {count}"],
    )

ClickCount()

You can also turn an idom element constructor into one that returns an ipywidget with the idom_juptyer.widgetize function. This is useful if you wish to use IDOM in combination with other Jupyter Widgets as in the following example:

ClickCountWidget = idom_jupyter.widgetize(ClickCount)
ipywidgets.Box(
    [
        ClickCountWidget(),
        ClickCountWidget(),
    ]
)

Alternatively just wrap an idom element instance in an idom_jupyter.LayoutWidget:

ipywidgets.Box(
    [
        idom_jupyter.LayoutWidget(ClickCount()),
        idom_jupyter.LayoutWidget(ClickCount()),
    ]
)

For a more detailed introduction check out this live demo here:

Binder

Development Installation

For a development installation (requires Node.js and Yarn version 1),

$ git clone https://github.com/idom-team/idom-jupyter.git
$ cd idom-jupyter
$ pip install -e .
$ jupyter nbextension install --py --symlink --overwrite --sys-prefix idom_jupyter
$ jupyter nbextension enable --py --sys-prefix idom_jupyter

When actively developing your extension for JupyterLab, run the command:

$ jupyter labextension develop --overwrite idom_jupyter

Then you need to rebuild the JS when you make a code change:

$ cd js
$ yarn run build

You then need to refresh the JupyterLab page when your javascript changes.

Metadata

Release files for idom-jupyter 0.7.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for idom-jupyter 0.7.7
File Size Uploaded
idom_jupyter-0.7.7.tar.gz 210.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for idom-jupyter 0.7.7
File Interpreter ABI Platform
idom_jupyter-0.7.7-py3-none-any.whl Python 3 none any Details

Total release size: 366.3 kB

Release files / idom_jupyter-0.7.7.tar.gz

Download URL idom_jupyter-0.7.7.tar.gz
Size 210.4 kB
Tags Source
SHA-256 checksum
How to use checksums
56386a2e072dcdc004c07fcece8fdfc2a5647fdc27a6539f32b8a4cf61641485
BLAKE2b-256 checksum
How to use checksums
653ef2c32f0ac8372b3be41582503bac2c8f739a4d860e63e299c587ca266afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / idom_jupyter-0.7.7-py3-none-any.whl

Download URL idom_jupyter-0.7.7-py3-none-any.whl
Size 155.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2af11083de1d9147290318c029f22b20d407300aab2a9db59b521725f271923a
BLAKE2b-256 checksum
How to use checksums
64d9803b88eb01e8dcd9d0597a3453e27221545e619a1ad1073008c68653bb64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.7.7 This release

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page