itables 2.1.5__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {itables-2.1.5 → itables-2.2.0}/.github/workflows/continuous-integration.yml +4 -0
- {itables-2.1.5 → itables-2.2.0}/.github/workflows/publish-book.yml +1 -0
- {itables-2.1.5 → itables-2.2.0}/.gitignore +3 -0
- {itables-2.1.5 → itables-2.2.0}/.pre-commit-config.yaml +1 -1
- {itables-2.1.5 → itables-2.2.0}/PKG-INFO +31 -5
- {itables-2.1.5 → itables-2.2.0}/README.md +6 -4
- {itables-2.1.5 → itables-2.2.0}/docs/_toc.yml +7 -6
- {itables-2.1.5 → itables-2.2.0}/docs/changelog.md +17 -2
- {itables-2.1.5 → itables-2.2.0}/docs/extensions.md +1 -27
- itables-2.2.0/docs/ipywidgets.md +118 -0
- {itables-2.1.5 → itables-2.2.0}/docs/quick_start.md +1 -0
- itables-2.2.0/docs/select.md +84 -0
- itables-2.2.0/docs/shiny.md +22 -0
- {itables-2.1.5 → itables-2.2.0}/docs/streamlit.md +7 -6
- {itables-2.1.5 → itables-2.2.0}/environment.yml +1 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/CHANGELOG.md +4 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/package-lock.json +2 -2
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/package.json +1 -1
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/src/index.js +20 -0
- itables-2.2.0/packages/itables_anywidget/README.md +29 -0
- itables-2.2.0/packages/itables_anywidget/js/widget.ts +103 -0
- itables-2.2.0/packages/itables_anywidget/package-lock.json +485 -0
- itables-2.2.0/packages/itables_anywidget/package.json +15 -0
- itables-2.2.0/packages/itables_anywidget/tsconfig.json +25 -0
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/package-lock.json +52 -41
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/src/index.tsx +20 -4
- {itables-2.1.5 → itables-2.2.0}/packages/package.json +2 -1
- {itables-2.1.5 → itables-2.2.0}/pyproject.toml +22 -5
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/dt_bundle.js +4 -4
- itables-2.2.0/src/itables/interactive.py +5 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/itables_for_streamlit/asset-manifest.json +3 -3
- {itables-2.1.5 → itables-2.2.0}/src/itables/itables_for_streamlit/index.html +1 -1
- itables-2.1.5/src/itables/itables_for_streamlit/static/js/main.f3394baa.js → itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js +3 -3
- itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js.map +1 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/javascript.py +115 -29
- {itables-2.1.5 → itables-2.2.0}/src/itables/options.py +4 -0
- itables-2.2.0/src/itables/shiny.py +63 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/streamlit.py +2 -2
- {itables-2.1.5 → itables-2.2.0}/src/itables/utils.py +1 -1
- {itables-2.1.5 → itables-2.2.0}/src/itables/version.py +1 -1
- itables-2.2.0/src/itables/widget/__init__.py +121 -0
- itables-2.2.0/src/itables/widget/static/widget.css +1 -0
- itables-2.2.0/src/itables/widget/static/widget.js +144 -0
- itables-2.2.0/tests/__init__.py +0 -0
- itables-2.2.0/tests/sample_python_apps/itables_in_a_shiny_app.py +41 -0
- {itables-2.1.5 → itables-2.2.0}/tests/sample_python_apps/itables_in_a_shiny_app_with_tabs.py +4 -7
- {itables-2.1.5 → itables-2.2.0}/tests/test_extension_arguments.py +13 -11
- {itables-2.1.5 → itables-2.2.0}/tests/test_javascript.py +3 -3
- {itables-2.1.5 → itables-2.2.0}/tests/test_sample_python_apps.py +9 -2
- itables-2.1.5/docs/ipywidgets.md +0 -4
- itables-2.1.5/docs/shiny.md +0 -14
- itables-2.1.5/src/itables/interactive.py +0 -15
- itables-2.1.5/src/itables/itables_for_streamlit/static/js/main.f3394baa.js.map +0 -1
- itables-2.1.5/src/itables/shiny.py +0 -8
- itables-2.1.5/tests/sample_python_apps/itables_in_a_shiny_app.py +0 -11
- {itables-2.1.5 → itables-2.2.0}/.github/codecov.yml +0 -0
- {itables-2.1.5 → itables-2.2.0}/.github/workflows/comment-pr.yml +0 -0
- {itables-2.1.5 → itables-2.2.0}/.github/workflows/publish.yml +0 -0
- {itables-2.1.5 → itables-2.2.0}/.pylintrc +0 -0
- {itables-2.1.5 → itables-2.2.0}/LICENSE +0 -0
- {itables-2.1.5 → itables-2.2.0}/binder/labconfig/default_setting_overrides.json +0 -0
- {itables-2.1.5 → itables-2.2.0}/binder/postBuild +0 -0
- {itables-2.1.5 → itables-2.2.0}/binder/requirements.txt +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/_config.yml +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/advanced_parameters.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/contributing.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/custom_css.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/custom_extensions.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/dark_mode.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/dash.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/developing.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/df_example.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/downsampling.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/formatting.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/html_export.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/code.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/colab.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/html.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/lab.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/notebook.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/images/pycharm.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/pandas_style.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/polars_dataframes.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/quarto/quarto_html.qmd +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/quarto/quarto_revealjs.qmd +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/quarto.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/references.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/sample_dataframes.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/show_df.png +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/supported_editors.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/docs/troubleshooting.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/LICENSE +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/README.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/src/index.css +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/dt_for_itables/src/index.d.ts +0 -0
- /itables-2.1.5/tests/__init__.py → /itables-2.2.0/packages/itables_anywidget/js/widget.css +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/README.md +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/package.json +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/public/index.html +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/itables_for_streamlit/tsconfig.json +0 -0
- {itables-2.1.5 → itables-2.2.0}/packages/package-lock.json +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/__init__.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/datatables_format.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/downsample.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/column_filters/initComplete.js +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/column_filters/pre_dt_code.js +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/datatables_template.html +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/dt_bundle.css +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/html/init_datatables.html +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/itables_for_streamlit/static/css/main.b5025928.css +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/itables_for_streamlit/static/css/main.b5025928.css.map +0 -0
- /itables-2.1.5/src/itables/itables_for_streamlit/static/js/main.f3394baa.js.LICENSE.txt → /itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js.LICENSE.txt +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/logo/loading.svg +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/logo/logo.svg +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/logo/text.svg +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/logo/wide.svg +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/logo/with_text.svg +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/sample_dfs.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/samples/countries.csv +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/samples/indicators.csv +0 -0
- {itables-2.1.5 → itables-2.2.0}/src/itables/samples/population.csv +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/conftest.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_changelog.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_connected_notebook_is_small.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_datatables_format.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_documentation_notebooks_run.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_downsample.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_html_in_table_header.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_init.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_json_dumps.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_notebook.ipynb +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_pandas_style.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_polars.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_sample_dfs.py +0 -0
- {itables-2.1.5 → itables-2.2.0}/tests/test_update_samples.py +0 -0
|
@@ -32,7 +32,7 @@ repos:
|
|
|
32
32
|
rev: v1.16.2
|
|
33
33
|
hooks:
|
|
34
34
|
- id: jupytext
|
|
35
|
-
exclude:
|
|
35
|
+
exclude: packages/
|
|
36
36
|
types: ["markdown"]
|
|
37
37
|
args: ["--pipe", "isort {} --treat-comment-as-code '# %%' --profile black", "--pipe", "black", "--check", "ruff check {} --ignore E402"]
|
|
38
38
|
additional_dependencies:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: itables
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Pandas and Polar DataFrames as interactive DataTables
|
|
5
5
|
Project-URL: Homepage, https://mwouts.github.io/itables/
|
|
6
6
|
Project-URL: Documentation, https://mwouts.github.io/itables
|
|
@@ -50,11 +50,30 @@ Requires-Dist: ipython
|
|
|
50
50
|
Requires-Dist: numpy
|
|
51
51
|
Requires-Dist: pandas
|
|
52
52
|
Provides-Extra: all
|
|
53
|
+
Requires-Dist: anywidget; extra == 'all'
|
|
53
54
|
Requires-Dist: matplotlib; extra == 'all'
|
|
54
55
|
Requires-Dist: polars; extra == 'all'
|
|
55
56
|
Requires-Dist: pyarrow; extra == 'all'
|
|
56
57
|
Requires-Dist: pytz; extra == 'all'
|
|
58
|
+
Requires-Dist: traitlets; extra == 'all'
|
|
57
59
|
Requires-Dist: world-bank-data; extra == 'all'
|
|
60
|
+
Provides-Extra: dev
|
|
61
|
+
Requires-Dist: anywidget; extra == 'dev'
|
|
62
|
+
Requires-Dist: ipykernel; extra == 'dev'
|
|
63
|
+
Requires-Dist: jupyterlab; extra == 'dev'
|
|
64
|
+
Requires-Dist: jupytext; extra == 'dev'
|
|
65
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
66
|
+
Requires-Dist: nbconvert; extra == 'dev'
|
|
67
|
+
Requires-Dist: polars; extra == 'dev'
|
|
68
|
+
Requires-Dist: pyarrow; extra == 'dev'
|
|
69
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
70
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
71
|
+
Requires-Dist: pytz; extra == 'dev'
|
|
72
|
+
Requires-Dist: requests; extra == 'dev'
|
|
73
|
+
Requires-Dist: shiny; extra == 'dev'
|
|
74
|
+
Requires-Dist: traitlets; extra == 'dev'
|
|
75
|
+
Requires-Dist: watchfiles; extra == 'dev'
|
|
76
|
+
Requires-Dist: world-bank-data; extra == 'dev'
|
|
58
77
|
Provides-Extra: polars
|
|
59
78
|
Requires-Dist: polars; extra == 'polars'
|
|
60
79
|
Requires-Dist: pyarrow; extra == 'polars'
|
|
@@ -64,6 +83,7 @@ Requires-Dist: world-bank-data; extra == 'samples'
|
|
|
64
83
|
Provides-Extra: style
|
|
65
84
|
Requires-Dist: matplotlib; extra == 'style'
|
|
66
85
|
Provides-Extra: test
|
|
86
|
+
Requires-Dist: anywidget; extra == 'test'
|
|
67
87
|
Requires-Dist: ipykernel; extra == 'test'
|
|
68
88
|
Requires-Dist: jupytext; extra == 'test'
|
|
69
89
|
Requires-Dist: matplotlib; extra == 'test'
|
|
@@ -75,7 +95,11 @@ Requires-Dist: pytest-cov; extra == 'test'
|
|
|
75
95
|
Requires-Dist: pytz; extra == 'test'
|
|
76
96
|
Requires-Dist: requests; extra == 'test'
|
|
77
97
|
Requires-Dist: shiny; extra == 'test'
|
|
98
|
+
Requires-Dist: traitlets; extra == 'test'
|
|
78
99
|
Requires-Dist: world-bank-data; extra == 'test'
|
|
100
|
+
Provides-Extra: widget
|
|
101
|
+
Requires-Dist: anywidget; extra == 'widget'
|
|
102
|
+
Requires-Dist: traitlets; extra == 'widget'
|
|
79
103
|
Description-Content-Type: text/markdown
|
|
80
104
|
|
|
81
105
|

|
|
@@ -86,6 +110,7 @@ Description-Content-Type: text/markdown
|
|
|
86
110
|
[](https://anaconda.org/conda-forge/itables)
|
|
87
111
|
[](https://pypi.python.org/pypi/itables)
|
|
88
112
|
[](https://github.com/psf/black)
|
|
113
|
+
[](https://mwouts.github.io/itables/ipywidgets.html)
|
|
89
114
|
[](https://itables.streamlit.app)
|
|
90
115
|
|
|
91
116
|
This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
|
|
@@ -128,7 +153,7 @@ and then render any DataFrame as an interactive table that you can sort, search
|
|
|
128
153
|
If you prefer to render only selected DataFrames as interactive tables, use `itables.show` to show just one Series or DataFrame as an interactive table:
|
|
129
154
|

|
|
130
155
|
|
|
131
|
-
Since
|
|
156
|
+
Since ITables v1.0, the [jQuery](https://jquery.com/) and [DataTables](https://datatables.net/) libraries and CSS
|
|
132
157
|
are injected in the notebook when you execute `init_notebook_mode` with its default argument `connected=False`.
|
|
133
158
|
Thanks to this the interactive tables will work even without a connection to the internet.
|
|
134
159
|
|
|
@@ -143,6 +168,7 @@ You can also use ITables in [Quarto](https://mwouts.github.io/itables/quarto.htm
|
|
|
143
168
|
|
|
144
169
|
ITables works well in VS Code, both in Jupyter Notebooks and in interactive Python sessions.
|
|
145
170
|
|
|
146
|
-
Last but not least, ITables is also available
|
|
147
|
-
[
|
|
148
|
-
[
|
|
171
|
+
Last but not least, ITables is also available as
|
|
172
|
+
- a [Jupyter Widget](https://mwouts.github.io/itables/ipywidgets.html)
|
|
173
|
+
- a [Streamlit](https://mwouts.github.io/itables/streamlit.html) component,
|
|
174
|
+
- and it also works in [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[](https://anaconda.org/conda-forge/itables)
|
|
7
7
|
[](https://pypi.python.org/pypi/itables)
|
|
8
8
|
[](https://github.com/psf/black)
|
|
9
|
+
[](https://mwouts.github.io/itables/ipywidgets.html)
|
|
9
10
|
[](https://itables.streamlit.app)
|
|
10
11
|
|
|
11
12
|
This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
|
|
@@ -48,7 +49,7 @@ and then render any DataFrame as an interactive table that you can sort, search
|
|
|
48
49
|
If you prefer to render only selected DataFrames as interactive tables, use `itables.show` to show just one Series or DataFrame as an interactive table:
|
|
49
50
|

|
|
50
51
|
|
|
51
|
-
Since
|
|
52
|
+
Since ITables v1.0, the [jQuery](https://jquery.com/) and [DataTables](https://datatables.net/) libraries and CSS
|
|
52
53
|
are injected in the notebook when you execute `init_notebook_mode` with its default argument `connected=False`.
|
|
53
54
|
Thanks to this the interactive tables will work even without a connection to the internet.
|
|
54
55
|
|
|
@@ -63,6 +64,7 @@ You can also use ITables in [Quarto](https://mwouts.github.io/itables/quarto.htm
|
|
|
63
64
|
|
|
64
65
|
ITables works well in VS Code, both in Jupyter Notebooks and in interactive Python sessions.
|
|
65
66
|
|
|
66
|
-
Last but not least, ITables is also available
|
|
67
|
-
[
|
|
68
|
-
[
|
|
67
|
+
Last but not least, ITables is also available as
|
|
68
|
+
- a [Jupyter Widget](https://mwouts.github.io/itables/ipywidgets.html)
|
|
69
|
+
- a [Streamlit](https://mwouts.github.io/itables/streamlit.html) component,
|
|
70
|
+
- and it also works in [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
|
|
@@ -4,11 +4,12 @@ parts:
|
|
|
4
4
|
- caption: ITables in Notebooks
|
|
5
5
|
chapters:
|
|
6
6
|
- file: advanced_parameters
|
|
7
|
+
- file: select
|
|
8
|
+
- file: extensions
|
|
9
|
+
- file: custom_extensions
|
|
7
10
|
- file: custom_css
|
|
8
11
|
- file: formatting
|
|
9
12
|
- file: pandas_style
|
|
10
|
-
- file: extensions
|
|
11
|
-
- file: custom_extensions
|
|
12
13
|
- file: dark_mode
|
|
13
14
|
- file: quarto
|
|
14
15
|
- file: downsampling
|
|
@@ -16,11 +17,11 @@ parts:
|
|
|
16
17
|
- file: supported_editors
|
|
17
18
|
- caption: ITables in Applications
|
|
18
19
|
chapters:
|
|
19
|
-
- file: html_export
|
|
20
|
-
- file: dash
|
|
21
|
-
- file: shiny
|
|
22
|
-
- file: streamlit
|
|
23
20
|
- file: ipywidgets
|
|
21
|
+
- file: streamlit
|
|
22
|
+
- file: shiny
|
|
23
|
+
- file: dash
|
|
24
|
+
- file: html_export
|
|
24
25
|
- caption: Contributing to ITables
|
|
25
26
|
chapters:
|
|
26
27
|
- file: contributing
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
ITables ChangeLog
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
+
2.2.0 (2024-09-22)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
**Added**
|
|
8
|
+
- ITables has a Jupyter Widget ([#267](https://github.com/mwouts/itables/issues/267)). Our widget was developed and packaged using [AnyWidget](https://anywidget.dev/) which I highly recommend!
|
|
9
|
+
- The selected rows are now available in the apps. Use either the `selected_rows` attribute of the `ITable` widget, the returned value of the Streamlit `interactive_table` component, or the `{table_id}_selected_rows` input in Shiny ([#208](https://github.com/mwouts/itables/issues/208), [#250](https://github.com/mwouts/itables/issues/250))
|
|
10
|
+
- ITables works offline in Shiny applications too - just add `ui.HTML(init_itables())` to your application
|
|
11
|
+
|
|
12
|
+
**Changed**
|
|
13
|
+
- The `tableId` argument of `to_html_datatable` has been renamed to `table_id`
|
|
14
|
+
|
|
15
|
+
**Fixed**
|
|
16
|
+
- The dependencies of the Streamlit component have been updated ([#320](https://github.com/mwouts/itables/issues/320))
|
|
17
|
+
|
|
18
|
+
|
|
4
19
|
2.1.5 (2024-09-08)
|
|
5
20
|
------------------
|
|
6
21
|
|
|
@@ -10,7 +25,7 @@ ITables ChangeLog
|
|
|
10
25
|
- We have improved the function that determines whether a dark theme is being used ([#294](https://github.com/mwouts/itables/issues/294))
|
|
11
26
|
- We have adjusted the generation of the Polars sample dataframes to fix the CI ([Polars-18130](https://github.com/pola-rs/polars/issues/18130))
|
|
12
27
|
- The test on the Shiny app fallbacks to `ui.nav_panel` when `ui.nav` is not available
|
|
13
|
-
- The dependencies of the
|
|
28
|
+
- The dependencies of the Streamlit component have been updated ([#313](https://github.com/mwouts/itables/issues/313), [#315](https://github.com/mwouts/itables/issues/315))
|
|
14
29
|
|
|
15
30
|
|
|
16
31
|
2.1.4 (2024-07-03)
|
|
@@ -35,7 +50,7 @@ ITables ChangeLog
|
|
|
35
50
|
an automatic horizontal scrolling in Jupyter, Jupyter Book and also Streamlit if the table is too wide ([#282](https://github.com/mwouts/itables/pull/282)).
|
|
36
51
|
|
|
37
52
|
**Fixed**
|
|
38
|
-
- The dependencies of the
|
|
53
|
+
- The dependencies of the Streamlit components have been updated to fix a vulnerability in `ws` ([Alert 1](https://github.com/mwouts/itables/security/dependabot/1))
|
|
39
54
|
|
|
40
55
|
|
|
41
56
|
2.1.1 (2024-06-08)
|
|
@@ -105,7 +105,7 @@ show(
|
|
|
105
105
|
```{tip}
|
|
106
106
|
Only the filtered or selected rows are exported to CSV/Excel. To filter the rows you
|
|
107
107
|
can use the simple search box, the [SearchPanes](#searchpanes) and [SearchBuilder](#searchbuilder)
|
|
108
|
-
options, or the [select](
|
|
108
|
+
options, or the [select](select.md) extension.
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
```{warning}
|
|
@@ -261,32 +261,6 @@ opt.keys = True
|
|
|
261
261
|
The KeyTable extension works in Jupyter Book (try it here in the documentation) but not in JupyterLab.
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
## Row selection
|
|
265
|
-
|
|
266
|
-
The [select](https://datatables.net/extensions/select) extension let you select rows (or cells). When you do so,
|
|
267
|
-
only the selected rows are exported
|
|
268
|
-
|
|
269
|
-
```{code-cell}
|
|
270
|
-
:tags: [full-width]
|
|
271
|
-
|
|
272
|
-
show(df, select=True, buttons=["copyHtml5", "csvHtml5", "excelHtml5"])
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
```{tip}
|
|
276
|
-
The `select` option accept multiple values, as documented [here](https://datatables.net/extensions/select):
|
|
277
|
-
- `select=True` or `select="os"` let you select using single click, shift-click and ctrl-click
|
|
278
|
-
- `select="single"` let you select a single row
|
|
279
|
-
- `select="multi"` for single click selection of multiple rows, `select="multi+shift"`, ...
|
|
280
|
-
|
|
281
|
-
With `select={"style": "os", "items": "cell"}` you can let the user select specific cells,
|
|
282
|
-
however cell selection is not taken into account when exporting the data.
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
```{tip}
|
|
286
|
-
At the moment it is not possible to get the selected rows back in Python. Please subscribe to
|
|
287
|
-
[#250](https://github.com/mwouts/itables/issues/250) to get updates on this topic.
|
|
288
|
-
```
|
|
289
|
-
|
|
290
264
|
## RowGroup
|
|
291
265
|
|
|
292
266
|
Use the [RowGroup](https://datatables.net/extensions/rowgroup/) extension to group
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
jupytext:
|
|
3
|
+
formats: md:myst
|
|
4
|
+
notebook_metadata_filter: -jupytext.text_representation.jupytext_version
|
|
5
|
+
text_representation:
|
|
6
|
+
extension: .md
|
|
7
|
+
format_name: myst
|
|
8
|
+
format_version: 0.13
|
|
9
|
+
kernelspec:
|
|
10
|
+
display_name: itables
|
|
11
|
+
language: python
|
|
12
|
+
name: itables
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Jupyter Widget
|
|
16
|
+
|
|
17
|
+
ITables is available as a [Jupyter Widget](https://ipywidgets.readthedocs.io) since v2.2.
|
|
18
|
+
|
|
19
|
+
## The `ITable` widget
|
|
20
|
+
|
|
21
|
+
The `ITable` widget has a few dependencies (essentially [AnyWidget](https://anywidget.dev),
|
|
22
|
+
a great widget development framework!) that you can install with
|
|
23
|
+
```bash
|
|
24
|
+
pip install itables[widget]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The `ITable` class accepts the same arguments as the `show` method, but
|
|
28
|
+
the `df` argument is optional.
|
|
29
|
+
|
|
30
|
+
```{code-cell}
|
|
31
|
+
from itables.sample_dfs import get_dict_of_test_dfs
|
|
32
|
+
from itables.widget import ITable
|
|
33
|
+
|
|
34
|
+
df = get_dict_of_test_dfs()["int_float_str"]
|
|
35
|
+
|
|
36
|
+
table = ITable(df, selected_rows=[0, 2, 5], select=True)
|
|
37
|
+
table
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## The `selected_rows` traits
|
|
41
|
+
|
|
42
|
+
The `selected_rows` attribute of the `ITable` object provides a view on the
|
|
43
|
+
rows that have been selected in the table (remember to pass [`select=True`](select.md)
|
|
44
|
+
to activate the row selection). You can use it to either retrieve
|
|
45
|
+
or change the current row selection:
|
|
46
|
+
|
|
47
|
+
```{code-cell}
|
|
48
|
+
table.selected_rows
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```{code-cell}
|
|
52
|
+
table.selected_rows = [3, 4]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## The `df` property
|
|
56
|
+
|
|
57
|
+
Use it to retrieve the table data:
|
|
58
|
+
|
|
59
|
+
```{code-cell}
|
|
60
|
+
table.df.iloc[table.selected_rows]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or to update it
|
|
64
|
+
|
|
65
|
+
```{code-cell}
|
|
66
|
+
table.df = df.head(6)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```{tip}
|
|
70
|
+
`ITable` will raise an `IndexError` if the `selected_rows` are not consistent with the
|
|
71
|
+
updated data. If you need to update the two simultaneously, use `table.update(df, selected_rows=...)`, see below.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## The `caption`, `style` and `classes` traits
|
|
75
|
+
|
|
76
|
+
You can update these traits from Python, e.g.
|
|
77
|
+
|
|
78
|
+
```{code-cell}
|
|
79
|
+
table.caption = "numbers and strings"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## The `update` method
|
|
83
|
+
|
|
84
|
+
Last but not least, you can update the `ITable` arguments simultaneously using the `update` method:
|
|
85
|
+
|
|
86
|
+
```{code-cell}
|
|
87
|
+
table.update(df.head(20), selected_rows=[7, 8])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Limitations
|
|
91
|
+
|
|
92
|
+
Compared to `show`, the `ITable` widget has the same limitations as the [Streamlit component](streamlit.md#limitations),
|
|
93
|
+
e.g. structured headers are not available, you can't pass JavaScript callback, etc.
|
|
94
|
+
|
|
95
|
+
The good news is that if you only want to _display_ the table, you do not need
|
|
96
|
+
the `ITables` widget. Below is an example in which we use `show` to display a different
|
|
97
|
+
table depending on the value of a drop-down component:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import ipywidgets as widgets
|
|
101
|
+
from itables import show
|
|
102
|
+
from itables.sample_dfs import get_dict_of_test_dfs
|
|
103
|
+
|
|
104
|
+
def use_show_in_interactive_output(table_name: str):
|
|
105
|
+
show(
|
|
106
|
+
sample_dfs[table_name],
|
|
107
|
+
caption=table_name,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
sample_dfs = get_dict_of_test_dfs()
|
|
111
|
+
table_selector = widgets.Dropdown(options=sample_dfs.keys(), value="int_float_str")
|
|
112
|
+
|
|
113
|
+
out = widgets.interactive_output(
|
|
114
|
+
use_show_in_interactive_output, {"table_name": table_selector}
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
widgets.VBox([table_selector, out])
|
|
118
|
+
```
|
|
@@ -20,6 +20,7 @@ kernelspec:
|
|
|
20
20
|
[](https://anaconda.org/conda-forge/itables)
|
|
21
21
|
[](https://pypi.python.org/pypi/itables)
|
|
22
22
|
[](https://github.com/psf/black)
|
|
23
|
+
[](ipywidgets.md)
|
|
23
24
|
[](https://itables.streamlit.app)
|
|
24
25
|
<a class="github-button" href="https://github.com/mwouts/itables" data-icon="octicon-star" data-show-count="true"></a>
|
|
25
26
|
<script src="https://buttons.github.io/buttons.js"></script>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
jupytext:
|
|
3
|
+
formats: md:myst
|
|
4
|
+
notebook_metadata_filter: -jupytext.text_representation.jupytext_version
|
|
5
|
+
text_representation:
|
|
6
|
+
extension: .md
|
|
7
|
+
format_name: myst
|
|
8
|
+
format_version: 0.13
|
|
9
|
+
kernelspec:
|
|
10
|
+
display_name: itables
|
|
11
|
+
language: python
|
|
12
|
+
name: itables
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Row selection
|
|
16
|
+
|
|
17
|
+
The [select](https://datatables.net/extensions/select) extension let you select rows (or cells). When you do so,
|
|
18
|
+
only the selected rows are exported
|
|
19
|
+
|
|
20
|
+
```{code-cell}
|
|
21
|
+
from itables import init_notebook_mode, show
|
|
22
|
+
|
|
23
|
+
init_notebook_mode()
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```{code-cell}
|
|
27
|
+
:tags: [hide-input]
|
|
28
|
+
|
|
29
|
+
import string
|
|
30
|
+
|
|
31
|
+
import numpy as np
|
|
32
|
+
import pandas as pd
|
|
33
|
+
|
|
34
|
+
from itables.sample_dfs import get_countries
|
|
35
|
+
|
|
36
|
+
df = get_countries(html=False)
|
|
37
|
+
# Add columns for the searchPanes demo
|
|
38
|
+
df["climate_zone"] = np.where(
|
|
39
|
+
df["latitude"].abs() < 23.43615,
|
|
40
|
+
"Tropical",
|
|
41
|
+
np.where(
|
|
42
|
+
df["latitude"].abs() < 35,
|
|
43
|
+
"Sub-tropical",
|
|
44
|
+
# Artic circle is 66.563861 but there is no capital there => using 64
|
|
45
|
+
np.where(df["latitude"].abs() < 64, "Temperate", "Frigid"),
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
df["hemisphere"] = np.where(df["latitude"] > 0, "North", "South")
|
|
49
|
+
wide_df = pd.DataFrame(
|
|
50
|
+
{
|
|
51
|
+
letter: np.random.normal(size=100)
|
|
52
|
+
for letter in string.ascii_lowercase + string.ascii_uppercase
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```{code-cell}
|
|
58
|
+
:tags: [full-width]
|
|
59
|
+
|
|
60
|
+
show(
|
|
61
|
+
df,
|
|
62
|
+
select=True,
|
|
63
|
+
selected_rows=[2, 4, 5],
|
|
64
|
+
buttons=["copyHtml5", "csvHtml5", "excelHtml5"],
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```{tip}
|
|
69
|
+
It is possible to get the updated `selected_rows` back in Python but for this you will have to use,
|
|
70
|
+
instead of `show`, either
|
|
71
|
+
- the `ITable` [Jupyter Widget](ipywidgets.md)
|
|
72
|
+
- the `interactive_table` [Streamlit component](streamlit.md)
|
|
73
|
+
- or `DT` in a [Shiny app](shiny.md).
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```{tip}
|
|
77
|
+
The `select` option accept multiple values, as documented [here](https://datatables.net/extensions/select):
|
|
78
|
+
- `select=True` or `select="os"` let you select using single click, shift-click and ctrl-click
|
|
79
|
+
- `select="single"` let you select a single row
|
|
80
|
+
- `select="multi"` for single click selection of multiple rows, `select="multi+shift"`, ...
|
|
81
|
+
|
|
82
|
+
With `select={"style": "os", "items": "cell"}` you can let the user select specific cells,
|
|
83
|
+
however cell selection is not taken into account when exporting the data.
|
|
84
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Shiny
|
|
2
|
+
|
|
3
|
+
You can use ITables in Web applications generated with [Shiny](https://shiny.rstudio.com/py/) for Python with e.g.
|
|
4
|
+
```python
|
|
5
|
+
from shiny import ui
|
|
6
|
+
|
|
7
|
+
from itables.sample_dfs import get_countries
|
|
8
|
+
from itables.shiny import DT, init_itables
|
|
9
|
+
|
|
10
|
+
# Load the datatables library and css from the ITables package
|
|
11
|
+
# (use connected=True if you prefer to load it from the internet)
|
|
12
|
+
ui.HTML(init_itables(connected=False))
|
|
13
|
+
|
|
14
|
+
# Render the table with DT
|
|
15
|
+
ui.HTML(DT(get_countries(html=False)))
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If you enable row selection and set an id on your table, e.g. `DT(df, table_id="my_table", select=True)` then
|
|
19
|
+
ITables will provide the list of selected rows at `input.my_table_selected_rows()` (replace `my_table` with your
|
|
20
|
+
own table id).
|
|
21
|
+
|
|
22
|
+
See also our [tested examples](https://github.com/mwouts/itables/tree/main/tests/sample_python_apps).
|
|
@@ -13,6 +13,13 @@ We have a sample application available at https://itables.streamlit.app (source
|
|
|
13
13
|
style="height: 600px; width: 100%;"></iframe>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
## Selected rows
|
|
17
|
+
|
|
18
|
+
This feature was added in ITables v2.2.0.
|
|
19
|
+
|
|
20
|
+
Use the `selected_rows: list[int]` argument from `interactive_table` to
|
|
21
|
+
select rows when the table is first displayed. Add `select=True` to let the user modify the selection. Then, the `interactive_table` component returns a dict, with a key `"selected_rows"` that points to the updated selection.
|
|
22
|
+
|
|
16
23
|
## Limitations
|
|
17
24
|
|
|
18
25
|
In most cases, you will be able to use `interactive_table` in a
|
|
@@ -42,9 +49,3 @@ A sample application is available at https://to-html-datatable.streamlit.app (so
|
|
|
42
49
|
<iframe src="https://to-html-datatable.streamlit.app?embed=true"
|
|
43
50
|
style="height: 600px; width: 100%;"></iframe>
|
|
44
51
|
```
|
|
45
|
-
|
|
46
|
-
## Future developments
|
|
47
|
-
|
|
48
|
-
ITables' Streamlit component might see the following developments in the future
|
|
49
|
-
- Return the selected cells
|
|
50
|
-
- Make the table editable (will require a DataTable [editor license](https://editor.datatables.net/purchase/))
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# 2.0.13 (2024-09-22)
|
|
2
|
+
|
|
3
|
+
- We have added two functions `set_selected_rows` and `get_selected_rows` to set and retrieve selected rows
|
|
4
|
+
|
|
1
5
|
# 2.0.12 (2024-09-08)
|
|
2
6
|
|
|
3
7
|
- We have added the datetime extension for DataTables ([#288](https://github.com/mwouts/itables/issues/288))
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dt_for_itables",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "dt_for_itables",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.13",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"datatables.net-buttons": "^3.0.1",
|
|
@@ -34,6 +34,26 @@ import 'datatables.net-select-dt/css/select.dataTables.min.css';
|
|
|
34
34
|
|
|
35
35
|
import './index.css';
|
|
36
36
|
|
|
37
|
+
DataTable.get_selected_rows = function (dt, filtered_row_count) {
|
|
38
|
+
// Here the selected rows are for the datatable.
|
|
39
|
+
// We convert them back to the full table
|
|
40
|
+
let data_row_count = dt.rows().count();
|
|
41
|
+
let bottom_half = data_row_count / 2;
|
|
42
|
+
return Array.from(dt.rows({ selected: true }).indexes().map(
|
|
43
|
+
i => (i < bottom_half ? i : i + filtered_row_count)));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
DataTable.set_selected_rows = function (dt, filtered_row_count, selected_rows) {
|
|
47
|
+
let data_row_count = dt.rows().count();
|
|
48
|
+
let bottom_half = data_row_count / 2;
|
|
49
|
+
let top_half = bottom_half + filtered_row_count;
|
|
50
|
+
let full_row_count = data_row_count + filtered_row_count;
|
|
51
|
+
selected_rows = Array.from(selected_rows.filter(i => i >= 0 && i < full_row_count && (i < bottom_half || i >= top_half)).map(
|
|
52
|
+
i => (i < bottom_half) ? i : i - filtered_row_count));
|
|
53
|
+
dt.rows().deselect();
|
|
54
|
+
dt.rows(selected_rows).select();
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
export { DataTable, DateTime, jQuery };
|
|
38
58
|
|
|
39
59
|
export default DataTable;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# itables_anywidget
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pip install itables_anywidget
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Development installation
|
|
10
|
+
|
|
11
|
+
Create a virtual environment and and install itables_anywidget in *editable* mode with the
|
|
12
|
+
optional development dependencies:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
python -m venv .venv
|
|
16
|
+
source .venv/bin/activate
|
|
17
|
+
pip install -e ".[dev]"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You then need to install the JavaScript dependencies and run the development server.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
|
|
28
|
+
to start developing. Changes made in `js/` will be reflected
|
|
29
|
+
in the notebook.
|