ipytablewidgets
NB: End to end tests use Galata framework.
Traitlets and widgets to efficiently data tables (e.g. Pandas DataFrame) using the jupyter notebook
ipytablewidgets is a set of widgets and traitlets to reuse of large tables such as Pandas DataFrames across different widgets, and different packages.
Installation
Using pip:
pip install ipytablewidgets
Development installation
The first step requires the following three commands to be run (requires yarn and jupyterlab>=3):
$ git clone https://github.com/progressivis/ipytablewidgets.git
$ cd ipytablewidgets
$ pip install -e .
The development of extensions for jupyter notebook and jupyter lab requires JavaScript code to be modified in-place. For this reason, lab and notebook extensions need to be configured this way:
- For jupyter notebook:
$ jupyter nbextension install --py --overwrite --symlink --sys-prefix ipytablewidgets $ jupyter nbextension enable --py --sys-prefix ipytablewidgets
- For jupyter lab:
$ jupyter labextension develop . --overwrite
Tables
The main widget for tables is the TableWidget class. It has a main trait: A
table. This table's main purpose is simply to be a standardized way of transmitting table
data from the kernel to the frontend, and to allow the data to be reused across
any number of other widgets, but with only a single sync across the network.
import pandas as pd
from ipytableidgets import TableWidget, PandasAdapter, serialization
@widgets.register
class MyWidget(DOMWidget):
"""
My widget needing a table
"""
_view_name = Unicode('MyWidgetView').tag(sync=True)
_model_name = Unicode('MyWidgetModel').tag(sync=True)
...
data = Instance(TableWidget).tag(sync=True, **serialization)
def __init__(self, wg, **kwargs):
self.data = wg
super().__init__(**kwargs)
df = pd.DataFrame({'a': [1,2], 'b': [3.5, 4.5], 'c': ['foo','bar'])
table_widget = TableWidget(PandasAdapter(df))
my_widget = MyWidget(table_widget)
You can see EchoTableWidget which is a more realistic example, currently used for end to end testing and demo.
Or, if you prefer to use the TableType traitlet directly:
from ipytablewidgets import serialization, TableType
@widgets.register
class MyWidget(DOMWidget):
"""
My widget needing a table
"""
...
data = TableType(None).tag(sync=True, **serialization)
Developers
Developers should consider using ipytablewidgets because:
- It gives readily accessible syncing of table data using the binary transfer protocol of ipywidgets.
- It gives compression methods speifically suited for columnar data.
- It avoids duplication of common code among different extensions, ensuring that bugs discovered for one extension gets fixed in all.
Overview
The major parts of ipyablewidgets are:
- Traits/Widgets definitions
- Adapters to convert tables to those traits
- Serializers/deserializers to send the data across the network
- Apropriate javascript handling and representation of the data
Metadata
Release files for ipytablewidgets 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ipytablewidgets-0.3.4.tar.gz | 241.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ipytablewidgets-0.3.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 431.7 kB
Release files / ipytablewidgets-0.3.4.tar.gz
| Download URL | ipytablewidgets-0.3.4.tar.gz |
|---|---|
| Size | 241.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e2e3ddf7926fa678e6d3d77d61b0f581724841c236416d0546d227a93718d19
|
|
BLAKE2b-256 checksum How to use checksums |
00b9b12debe0a5618c67af5f5425d5e1c32ffd8d4c979acfa006368401a8389e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / ipytablewidgets-0.3.4-py2.py3-none-any.whl
| Download URL | ipytablewidgets-0.3.4-py2.py3-none-any.whl |
|---|---|
| Size | 190.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
459b4d20f62b099eadbde2455a699aa2428e0b06ad884c5464408d89a542c8e4
|
|
BLAKE2b-256 checksum How to use checksums |
3f63c1b9999afd899eeaa19a94fae268b8017b5c876e553b0101c7807b02b34c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|