Skip to content

fleming79/ipylab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipylab

Github Actions Status JupyterLite Binder Conda Version pypi npm

Control JupyterLab from Python.

The goal is to provide access to most of the JupyterLab environment from the Python kernel. For example:

  • Adding widgets to the main area DockPanel, left, right or top area
  • Build more advanced interfaces leveraging SplitPanel, Toolbar and other Lumino widgets
  • Launch arbitrary commands (new terminal, change theme, open file and so on)
  • Open a workspace with a specific layout
  • Listen to JupyterLab signals (notebook opened, console closed) and trigger Python callbacks

Try it online

Try it in your browser with Binder:

Binder

Or with JupyterLite:

JupyterLite

Examples

Add Jupyter Widgets to the JupyterLab interface

widgets-panels

Execute Commands

command-registry

Custom Python Commands and Command Palette

custom-commands

Build small applications

ipytree-example

Installation

You can install using pip:

pip install ipylab

Dependencies

The following dependencies are provided as wheels in the pkg directory which include patches to improved the functionality.

Name Pull request Status Modification
traitlets #918 Accepted - pending release Improved type hints
ipywidgets, jupyterlab-widgets, widgetsnbextension #3922 + #3921 Pending review Provides for widgets comms without needing a notebook or console to be open. Plus fixes for proper garbage collection and widget tooltips
jupyter_client #1064 Pending review Faster message serialization

Examples

Example files can be downloaded directly from github here.

Under the hood

ipylab can be seen as a proxy from Python to JupyterLab over Jupyter Widgets:

ipylab-diagram

Development

The development environment is provided by uv.

Installation from source

If you are working on a pull request, [make a fork] of the project and install from your fork.

git clone <repository>
cd ipylab
uv venv -p python@311 # or whichever environment you are targeting.
uv sync
# Activate the uv environment

Frontend (Typescript/Javascript)

# Activate the uv environment

# compile the extension
jlpm clean
jlpm build

# **Frontend/typescript development only** link the extension files
jupyter labextension develop . --overwrite

# At this point you can run and debug. vscode configs are provided for Firefox and Chrome.
# "Debug Ipylab with Firefox | Chrome"
# pre-commit (optional)
pre-commit run

# or, to install the git hook
pre-commit install

# Use jlpm script to lint the JS
jlpm lint
#or
jlpm lint:check

!!! note

If you're developing the fronted on Windows you need to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development#activate-developer-mode) for symlinks to work.

[see also](https://discuss.python.org/t/add-os-junction-pathlib-path-junction-to/50394).

Upgrade files

=== "Python files"

```bash
uv sync -U
```

=== "Frontend"

TODO

Type checking

Type checking is performed using basedpyright.

basedpyright

VS code debugging

A config file is included to debug ipylab with Firefox or Chrome.

Related projects

There are a couple of projects that also enable interacting with the JupyterLab environment from Python notebooks:

About

Control JupyterLab from Python Notebooks with Jupyter Widgets 🧪 ☢️ 🐍

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 59.1%
  • TypeScript 40.5%
  • Other 0.4%