# ipytablewidgets
![Python tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/python.yml/badge.svg)
![Typescript tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/ts.yml/badge.svg)
![End to end tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/e2e.yml/badge.svg)
**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:
```bash
pip install ipytablewidgets
```
## Development installation
The first step requires the following three commands to be run (requires yarn and jupyterlab>=3):
```bash
$ 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:**
```bash
$ jupyter nbextension install --py --overwrite --symlink --sys-prefix ipytablewidgets
$ jupyter nbextension enable --py --sys-prefix ipytablewidgets
```
* For **jupyter lab:**
```bash
$ 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.
```python
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](https://github.com/progressivis/ipytablewidgets/blob/main/ipytablewidgets/widgets.py) which is a more realistic example, currently used for end to end testing and [demo](https://github.com/progressivis/ipytablewidgets/blob/main/notebooks/plain.ipynb).
Or, if you prefer to use the **TableType** traitlet directly:
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/progressivis/ipytablewidgets",
"name": "ipytablewidgets",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "ipython, jupyter, widgets",
"author": "Jean-Daniel Fekete, Christian Poli",
"author_email": "ipytablewidgets@inria.fr",
"download_url": "https://files.pythonhosted.org/packages/3b/05/fa65155c415a8cc7df8a715c882012b26de42dec1b55638fe4bf942b2849/ipytablewidgets-0.3.2.tar.gz",
"platform": "Linux",
"description": "# ipytablewidgets\n\n![Python tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/python.yml/badge.svg)\n\n![Typescript tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/ts.yml/badge.svg)\n\n![End to end tests](https://github.com/progressivis/ipytablewidgets/actions/workflows/e2e.yml/badge.svg)\n\n**NB:** End to end tests use [Galata]() framework.\n\nTraitlets and widgets to efficiently data tables (e.g. Pandas DataFrame) using the jupyter notebook\n\n\nipytablewidgets is a set of widgets and traitlets to reuse of large tables such as Pandas DataFrames\nacross different widgets, and different packages.\n\n\n## Installation\n\nUsing pip:\n\n```bash\npip install ipytablewidgets\n```\n\n## Development installation\n\nThe first step requires the following three commands to be run (requires yarn and jupyterlab>=3):\n\n```bash\n$ git clone https://github.com/progressivis/ipytablewidgets.git\n$ cd ipytablewidgets\n$ pip install -e .\n```\nThe 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:\n\n* For **jupyter notebook:**\n ```bash\n $ jupyter nbextension install --py --overwrite --symlink --sys-prefix ipytablewidgets\n $ jupyter nbextension enable --py --sys-prefix ipytablewidgets\n ```\n* For **jupyter lab:**\n ```bash\n $ jupyter labextension develop . --overwrite\n ```\n\n### Tables\n\nThe main widget for tables is the `TableWidget` class. It has a main trait: A\ntable. This table's main purpose is simply to be a standardized way of transmitting table\ndata from the kernel to the frontend, and to allow the data to be reused across\nany number of other widgets, but with only a single sync across the network.\n\n```python\nimport pandas as pd\nfrom ipytableidgets import TableWidget, PandasAdapter, serialization\n\n@widgets.register\nclass MyWidget(DOMWidget):\n \"\"\"\n My widget needing a table\n \"\"\"\n _view_name = Unicode('MyWidgetView').tag(sync=True)\n _model_name = Unicode('MyWidgetModel').tag(sync=True)\n ...\n data = Instance(TableWidget).tag(sync=True, **serialization)\n def __init__(self, wg, **kwargs):\n self.data = wg\n super().__init__(**kwargs)\n\ndf = pd.DataFrame({'a': [1,2], 'b': [3.5, 4.5], 'c': ['foo','bar'])\ntable_widget = TableWidget(PandasAdapter(df))\nmy_widget = MyWidget(table_widget)\n```\n\nYou can see [EchoTableWidget](https://github.com/progressivis/ipytablewidgets/blob/main/ipytablewidgets/widgets.py) which is a more realistic example, currently used for end to end testing and [demo](https://github.com/progressivis/ipytablewidgets/blob/main/notebooks/plain.ipynb).\n\nOr, if you prefer to use the **TableType** traitlet directly:\n```python\nfrom ipytablewidgets import serialization, TableType\n\n@widgets.register\nclass MyWidget(DOMWidget):\n \"\"\"\n My widget needing a table\n \"\"\"\n ...\n data = TableType(None).tag(sync=True, **serialization)\n```\n\n\n## Developers\n\nDevelopers should consider using ipytablewidgets because:\n\n- It gives readily accessible syncing of table data using the binary transfer\n protocol of ipywidgets.\n- It gives compression methods speifically suited for columnar data.\n- It avoids duplication of common code among different extensions, ensuring\n that bugs discovered for one extension gets fixed in all.\n\n\n### Overview\n\nThe major parts of ipyablewidgets are:\n\n- Traits/Widgets definitions\n- Adapters to convert tables to those traits\n- Serializers/deserializers to send the data across the network\n- Apropriate javascript handling and representation of the data\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "A set of widgets to help facilitate reuse of large tables across widgets",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://github.com/progressivis/ipytablewidgets"
},
"split_keywords": [
"ipython",
" jupyter",
" widgets"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f833f7b2eb46c19f3c67c5e6adbe9dfe144a0d91ebe717fd34795870f98a45b",
"md5": "78a1b75e1a60812b41780ee9fd68ea93",
"sha256": "a407d8350faca5ca58392eb4a53d9ebfcc2a98e4481f2b6b50bdae87728c24b8"
},
"downloads": -1,
"filename": "ipytablewidgets-0.3.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "78a1b75e1a60812b41780ee9fd68ea93",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 190211,
"upload_time": "2024-10-07T09:28:02",
"upload_time_iso_8601": "2024-10-07T09:28:02.863620Z",
"url": "https://files.pythonhosted.org/packages/7f/83/3f7b2eb46c19f3c67c5e6adbe9dfe144a0d91ebe717fd34795870f98a45b/ipytablewidgets-0.3.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b05fa65155c415a8cc7df8a715c882012b26de42dec1b55638fe4bf942b2849",
"md5": "a1de1dc240a3de1059ced8d9685a69f4",
"sha256": "08691bfff98b526932bfe8665495f9fb4e091827f0f93b5f0713135d6d1b86cc"
},
"downloads": -1,
"filename": "ipytablewidgets-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "a1de1dc240a3de1059ced8d9685a69f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 1007007,
"upload_time": "2024-10-07T09:28:05",
"upload_time_iso_8601": "2024-10-07T09:28:05.403065Z",
"url": "https://files.pythonhosted.org/packages/3b/05/fa65155c415a8cc7df8a715c882012b26de42dec1b55638fe4bf942b2849/ipytablewidgets-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-07 09:28:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "progressivis",
"github_project": "ipytablewidgets",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "ipytablewidgets"
}