Skip to content

Commit 8ba1a6f

Browse files
authored
Document the DataTable and ITable options (#372)
* Document the DataTable and the ITable options * Enforce pyright within the CI * Pre-commit autoupdate * Update Ubuntu and Python action versions * Require Python 3.9+, stop testing Pandas<1 * Update Copyright years * Set warn_on_undocumented_option=True only when typeguard is available * Check the type of the default options * Add tests on type checks * Type check only works well with typeguard>=4.4.1 on Python 3.10
1 parent c1d6a89 commit 8ba1a6f

31 files changed

+544
-264
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ jobs:
2222
uses: actions/setup-python@v5
2323
- uses: pre-commit/[email protected]
2424

25+
pyright:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
cache: 'pip'
34+
- run: |
35+
python -m venv .venv
36+
source .venv/bin/activate
37+
pip install pandas-stubs
38+
pip install streamlit
39+
pip install -e .[test]
40+
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
41+
- name: Run Pyright
42+
uses: jakebailey/pyright-action@v2
43+
with:
44+
pylance-version: latest-release
45+
2546
codeql:
2647
runs-on: ubuntu-latest
2748
permissions:
@@ -40,12 +61,11 @@ jobs:
4061
strategy:
4162
fail-fast: false
4263
matrix:
43-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12", "3.13"]
64+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
4465
pandas-version: [latest]
4566
numpy-version: [latest]
67+
typeguard-version: [latest]
4668
include:
47-
- python-version: 3.7
48-
pandas-version: '<1.0'
4969
- python-version: 3.9
5070
pandas-version: '<2.0'
5171
numpy-version: '<2.0'
@@ -54,7 +74,11 @@ jobs:
5474
polars: true
5575
- python-version: "3.13"
5676
uninstall_jinja2_and_dash: true
57-
runs-on: ubuntu-20.04
77+
- python-version: "3.10"
78+
typeguard-version: "<4.4.1"
79+
- python-version: "3.10"
80+
typeguard-version: "<4"
81+
runs-on: ubuntu-24.04
5882
steps:
5983
- name: Checkout
6084
uses: actions/checkout@v4
@@ -82,13 +106,15 @@ jobs:
82106
- name: Install numpy ${{ matrix.numpy-version }}
83107
if: matrix.numpy-version != 'latest'
84108
run: pip install 'numpy${{ matrix.numpy-version }}'
109+
- name: Install typeguard ${{ matrix.typeguard-version }}
110+
if: matrix.typeguard-version != 'latest'
111+
run: pip install 'typeguard${{ matrix.typeguard-version }}'
85112

86113
- name: Install polars
87114
if: matrix.polars
88115
run: pip install -e .[polars]
89116

90117
- name: Install shiny
91-
if: matrix.python-version != '3.7'
92118
run: pip install "shiny>=1.0"
93119

94120
- name: Uninstall jinja2 and dash

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ exclude: ^src/itables_for_dash/ITable.py$ # auto-generated
55
repos:
66

77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.6.0
8+
rev: v5.0.0
99
hooks:
1010
- id: check-json
1111
- id: check-yaml
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414

1515
- repo: https://github.com/timothycrosley/isort
16-
rev: 5.13.2
16+
rev: 6.0.1
1717
hooks:
1818
- id: isort
1919
args: ["--profile", "black", "--filter-files"]
2020

2121
- repo: https://github.com/psf/black
22-
rev: 24.4.2
22+
rev: 25.1.0
2323
hooks:
2424
- id: black
2525

2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.4.5
27+
rev: v0.11.7
2828
hooks:
2929
- id: ruff
3030
args: ["--fix", "--show-fixes"]
3131

3232
- repo: https://github.com/mwouts/jupytext
33-
rev: v1.17.0
33+
rev: v1.17.1
3434
hooks:
3535
- id: jupytext
3636
exclude: packages/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![Dash Component](https://img.shields.io/badge/Dash-Plotly-1098F7.svg?style=flat&logo=Plotly)](https://mwouts.github.io/itables/dash.html)
1212
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_red.svg)](https://itables.streamlit.app)
1313

14-
This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
14+
This packages changes how Pandas and Polars DataFrames are rendered in Python notebooks and applications.
1515
With `itables` you can display your tables as interactive [DataTables](https://datatables.net/)
1616
that you can sort, paginate, scroll or filter.
1717

@@ -39,7 +39,7 @@ or
3939
conda install itables -c conda-forge
4040
```
4141

42-
Activate the interactive mode for all series and dataframes with
42+
Activate the interactive mode for all series and dataframes in Jupyter with
4343
```python
4444
import itables
4545

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Interactive Tables
22
author: Marc Wouts
3-
copyright: "2019-2024"
3+
copyright: "2019-2025"
44
logo: "../src/itables/logo/logo.svg"
55
execute:
66
execute_notebooks: force

docs/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
ITables ChangeLog
22
=================
33

4+
2.4.0-dev
5+
---------
6+
7+
**Added**
8+
- We have added type hints for the `show` function and for the various app components. A SyntaxWarning is issued if either the argument name or type does not match when `warn_on_undocumented_option=True` (the default when `typeguard>=4.4.1` is installed).
9+
10+
**Changed**
11+
- ITable now requires Python 3.9, due to the addition of type hints.
12+
13+
414
2.3.0 (2025-04-05)
515
------------------
616

docs/dash.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Listening to the selected rows is simply done by adding `select=True` to the `IT
3434

3535
## Updating the DataFrame
3636

37-
The `ITable` fonction returns an `ITableComponent` that has many properties. These properties (data, columns, selected rows etc) need to be updated in a consistent way. Therefore we recommend that you list the outputs with `ITableOutputs("my_dataframe")` in your callback, and update them with `updated_itable_outputs` which takes the same arguments as `show`, e.g. `df`, `caption`,`selected_rows`, etc, like in the below (extracted from this [example app](https://github.com/mwouts/itables/tree/main/apps/dash/3_update_table.py)):
37+
The `ITable` component has many properties. These properties (data, columns, selected rows etc) need to be updated in a consistent way. Therefore we recommend that you list the outputs with `ITableOutputs("my_dataframe")` in your callback, and update them with `updated_itable_outputs` which takes the same arguments as `show`, e.g. `df`, `caption`, `selected_rows`, etc, like in the below (extracted from this [example app](https://github.com/mwouts/itables/tree/main/apps/dash/3_update_table.py)):
3838

3939
```python
4040
from itables.dash import ITable, ITableOutputs, updated_itable_outputs

docs/quick_start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ kernelspec:
2727
<a class="github-button" href="https://github.com/mwouts/itables" data-icon="octicon-star" data-show-count="true"></a>
2828
<script src="https://buttons.github.io/buttons.js"></script>
2929

30-
This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
30+
This packages changes how Pandas and Polars DataFrames are rendered in Python notebooks and applications.
3131
With `itables` you can display your tables as interactive [DataTables](https://datatables.net/)
3232
that you can sort, paginate, scroll or filter.
3333

environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ dependencies:
1818
- pytest-xdist
1919
- pytest-cov
2020
- pre-commit
21+
- pyright
22+
- typeguard
2123
- pip
2224
- setuptools
2325
- twine

packages/dt_for_itables/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Marc Wouts
3+
Copyright (c) 2024-2025 Marc Wouts
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,23 @@ classifiers = [
1818
"Intended Audience :: Science/Research",
1919
"Programming Language :: Python",
2020
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.7",
22-
"Programming Language :: Python :: 3.8",
2321
"Programming Language :: Python :: 3.9",
2422
"Programming Language :: Python :: 3.10",
2523
"Programming Language :: Python :: 3.11",
2624
"Programming Language :: Python :: 3.12",
2725
"Programming Language :: Python :: 3.13",
2826
]
29-
requires-python = ">= 3.7"
27+
requires-python = ">= 3.9"
3028
dependencies = ["IPython", "pandas", "numpy"]
3129
dynamic = ["version"]
3230

3331
[project.optional-dependencies]
3432
polars = ["polars", "pyarrow"]
33+
check_type = ["typeguard>=4.4.1"]
3534
style = ["matplotlib"]
3635
samples = ["pytz", "world_bank_data"]
3736
widget = ["anywidget", "traitlets"]
38-
all = ["itables[polars,style,samples,widget]"]
37+
all = ["itables[polars,style,samples,widget,check_type]"]
3938
test = [
4039
"itables[all]",
4140
# Pytest

0 commit comments

Comments
 (0)