itables 2.1.4__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.
Files changed (143) hide show
  1. {itables-2.1.4 → itables-2.2.0}/.github/workflows/continuous-integration.yml +4 -0
  2. {itables-2.1.4 → itables-2.2.0}/.github/workflows/publish-book.yml +1 -0
  3. {itables-2.1.4 → itables-2.2.0}/.gitignore +3 -0
  4. {itables-2.1.4 → itables-2.2.0}/.pre-commit-config.yaml +1 -1
  5. {itables-2.1.4 → itables-2.2.0}/PKG-INFO +32 -6
  6. {itables-2.1.4 → itables-2.2.0}/README.md +7 -5
  7. {itables-2.1.4 → itables-2.2.0}/docs/_toc.yml +8 -6
  8. {itables-2.1.4 → itables-2.2.0}/docs/changelog.md +28 -1
  9. itables-2.2.0/docs/dark_mode.md +28 -0
  10. {itables-2.1.4 → itables-2.2.0}/docs/extensions.md +1 -27
  11. itables-2.2.0/docs/ipywidgets.md +118 -0
  12. {itables-2.1.4 → itables-2.2.0}/docs/quick_start.md +2 -1
  13. itables-2.2.0/docs/select.md +84 -0
  14. itables-2.2.0/docs/shiny.md +22 -0
  15. itables-2.2.0/docs/streamlit.md +51 -0
  16. {itables-2.1.4 → itables-2.2.0}/environment.yml +1 -0
  17. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/CHANGELOG.md +9 -1
  18. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/README.md +1 -1
  19. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/package-lock.json +223 -231
  20. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/package.json +10 -8
  21. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/src/index.js +24 -1
  22. itables-2.2.0/packages/itables_anywidget/README.md +29 -0
  23. itables-2.2.0/packages/itables_anywidget/js/widget.ts +103 -0
  24. itables-2.2.0/packages/itables_anywidget/package-lock.json +485 -0
  25. itables-2.2.0/packages/itables_anywidget/package.json +15 -0
  26. itables-2.2.0/packages/itables_anywidget/tsconfig.json +25 -0
  27. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/package-lock.json +77 -74
  28. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/src/index.tsx +20 -4
  29. {itables-2.1.4 → itables-2.2.0}/packages/package.json +2 -1
  30. {itables-2.1.4 → itables-2.2.0}/pyproject.toml +22 -5
  31. itables-2.2.0/src/itables/html/dt_bundle.css +1 -0
  32. itables-2.2.0/src/itables/html/dt_bundle.js +144 -0
  33. itables-2.2.0/src/itables/html/init_datatables.html +25 -0
  34. itables-2.2.0/src/itables/interactive.py +5 -0
  35. itables-2.2.0/src/itables/itables_for_streamlit/asset-manifest.json +13 -0
  36. {itables-2.1.4 → itables-2.2.0}/src/itables/itables_for_streamlit/index.html +1 -1
  37. itables-2.2.0/src/itables/itables_for_streamlit/static/css/main.b5025928.css +2 -0
  38. itables-2.2.0/src/itables/itables_for_streamlit/static/css/main.b5025928.css.map +1 -0
  39. itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js +3 -0
  40. itables-2.1.4/src/itables/itables_for_streamlit/static/js/main.ffa367f6.js.LICENSE.txt → itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js.LICENSE.txt +12 -6
  41. itables-2.2.0/src/itables/itables_for_streamlit/static/js/main.f651d116.js.map +1 -0
  42. {itables-2.1.4 → itables-2.2.0}/src/itables/javascript.py +115 -29
  43. {itables-2.1.4 → itables-2.2.0}/src/itables/options.py +4 -0
  44. {itables-2.1.4 → itables-2.2.0}/src/itables/sample_dfs.py +8 -2
  45. itables-2.2.0/src/itables/shiny.py +63 -0
  46. {itables-2.1.4 → itables-2.2.0}/src/itables/streamlit.py +2 -2
  47. {itables-2.1.4 → itables-2.2.0}/src/itables/utils.py +1 -1
  48. {itables-2.1.4 → itables-2.2.0}/src/itables/version.py +1 -1
  49. itables-2.2.0/src/itables/widget/__init__.py +121 -0
  50. itables-2.2.0/src/itables/widget/static/widget.css +1 -0
  51. itables-2.2.0/src/itables/widget/static/widget.js +144 -0
  52. itables-2.2.0/tests/__init__.py +0 -0
  53. itables-2.2.0/tests/sample_python_apps/itables_in_a_shiny_app.py +41 -0
  54. {itables-2.1.4 → itables-2.2.0}/tests/sample_python_apps/itables_in_a_shiny_app_with_tabs.py +5 -2
  55. {itables-2.1.4 → itables-2.2.0}/tests/test_connected_notebook_is_small.py +1 -1
  56. {itables-2.1.4 → itables-2.2.0}/tests/test_extension_arguments.py +13 -11
  57. {itables-2.1.4 → itables-2.2.0}/tests/test_javascript.py +3 -3
  58. {itables-2.1.4 → itables-2.2.0}/tests/test_sample_python_apps.py +9 -2
  59. {itables-2.1.4 → itables-2.2.0}/tests/test_update_samples.py +5 -0
  60. itables-2.1.4/docs/ipywidgets.md +0 -4
  61. itables-2.1.4/docs/shiny.md +0 -14
  62. itables-2.1.4/docs/streamlit.md +0 -39
  63. itables-2.1.4/src/itables/html/dt_bundle.css +0 -1
  64. itables-2.1.4/src/itables/html/dt_bundle.js +0 -137
  65. itables-2.1.4/src/itables/html/init_datatables.html +0 -11
  66. itables-2.1.4/src/itables/interactive.py +0 -15
  67. itables-2.1.4/src/itables/itables_for_streamlit/asset-manifest.json +0 -13
  68. itables-2.1.4/src/itables/itables_for_streamlit/static/css/main.8eddd46d.css +0 -2
  69. itables-2.1.4/src/itables/itables_for_streamlit/static/css/main.8eddd46d.css.map +0 -1
  70. itables-2.1.4/src/itables/itables_for_streamlit/static/js/main.ffa367f6.js +0 -3
  71. itables-2.1.4/src/itables/itables_for_streamlit/static/js/main.ffa367f6.js.map +0 -1
  72. itables-2.1.4/src/itables/shiny.py +0 -8
  73. itables-2.1.4/tests/sample_python_apps/itables_in_a_shiny_app.py +0 -11
  74. {itables-2.1.4 → itables-2.2.0}/.github/codecov.yml +0 -0
  75. {itables-2.1.4 → itables-2.2.0}/.github/workflows/comment-pr.yml +0 -0
  76. {itables-2.1.4 → itables-2.2.0}/.github/workflows/publish.yml +0 -0
  77. {itables-2.1.4 → itables-2.2.0}/.pylintrc +0 -0
  78. {itables-2.1.4 → itables-2.2.0}/LICENSE +0 -0
  79. {itables-2.1.4 → itables-2.2.0}/binder/labconfig/default_setting_overrides.json +0 -0
  80. {itables-2.1.4 → itables-2.2.0}/binder/postBuild +0 -0
  81. {itables-2.1.4 → itables-2.2.0}/binder/requirements.txt +0 -0
  82. {itables-2.1.4 → itables-2.2.0}/docs/_config.yml +0 -0
  83. {itables-2.1.4 → itables-2.2.0}/docs/advanced_parameters.md +0 -0
  84. {itables-2.1.4 → itables-2.2.0}/docs/contributing.md +0 -0
  85. {itables-2.1.4 → itables-2.2.0}/docs/custom_css.md +0 -0
  86. {itables-2.1.4 → itables-2.2.0}/docs/custom_extensions.md +0 -0
  87. {itables-2.1.4 → itables-2.2.0}/docs/dash.md +0 -0
  88. {itables-2.1.4 → itables-2.2.0}/docs/developing.md +0 -0
  89. {itables-2.1.4 → itables-2.2.0}/docs/df_example.png +0 -0
  90. {itables-2.1.4 → itables-2.2.0}/docs/downsampling.md +0 -0
  91. {itables-2.1.4 → itables-2.2.0}/docs/formatting.md +0 -0
  92. {itables-2.1.4 → itables-2.2.0}/docs/html_export.md +0 -0
  93. {itables-2.1.4 → itables-2.2.0}/docs/images/code.png +0 -0
  94. {itables-2.1.4 → itables-2.2.0}/docs/images/colab.png +0 -0
  95. {itables-2.1.4 → itables-2.2.0}/docs/images/html.png +0 -0
  96. {itables-2.1.4 → itables-2.2.0}/docs/images/lab.png +0 -0
  97. {itables-2.1.4 → itables-2.2.0}/docs/images/notebook.png +0 -0
  98. {itables-2.1.4 → itables-2.2.0}/docs/images/pycharm.png +0 -0
  99. {itables-2.1.4 → itables-2.2.0}/docs/pandas_style.md +0 -0
  100. {itables-2.1.4 → itables-2.2.0}/docs/polars_dataframes.md +0 -0
  101. {itables-2.1.4 → itables-2.2.0}/docs/quarto/quarto_html.qmd +0 -0
  102. {itables-2.1.4 → itables-2.2.0}/docs/quarto/quarto_revealjs.qmd +0 -0
  103. {itables-2.1.4 → itables-2.2.0}/docs/quarto.md +0 -0
  104. {itables-2.1.4 → itables-2.2.0}/docs/references.md +0 -0
  105. {itables-2.1.4 → itables-2.2.0}/docs/sample_dataframes.md +0 -0
  106. {itables-2.1.4 → itables-2.2.0}/docs/show_df.png +0 -0
  107. {itables-2.1.4 → itables-2.2.0}/docs/supported_editors.md +0 -0
  108. {itables-2.1.4 → itables-2.2.0}/docs/troubleshooting.md +0 -0
  109. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/LICENSE +0 -0
  110. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/src/index.css +0 -0
  111. {itables-2.1.4 → itables-2.2.0}/packages/dt_for_itables/src/index.d.ts +0 -0
  112. /itables-2.1.4/tests/__init__.py → /itables-2.2.0/packages/itables_anywidget/js/widget.css +0 -0
  113. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/README.md +0 -0
  114. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/package.json +0 -0
  115. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/public/index.html +0 -0
  116. {itables-2.1.4 → itables-2.2.0}/packages/itables_for_streamlit/tsconfig.json +0 -0
  117. {itables-2.1.4 → itables-2.2.0}/packages/package-lock.json +0 -0
  118. {itables-2.1.4 → itables-2.2.0}/src/itables/__init__.py +0 -0
  119. {itables-2.1.4 → itables-2.2.0}/src/itables/datatables_format.py +0 -0
  120. {itables-2.1.4 → itables-2.2.0}/src/itables/downsample.py +0 -0
  121. {itables-2.1.4 → itables-2.2.0}/src/itables/html/column_filters/initComplete.js +0 -0
  122. {itables-2.1.4 → itables-2.2.0}/src/itables/html/column_filters/pre_dt_code.js +0 -0
  123. {itables-2.1.4 → itables-2.2.0}/src/itables/html/datatables_template.html +0 -0
  124. {itables-2.1.4 → itables-2.2.0}/src/itables/logo/loading.svg +0 -0
  125. {itables-2.1.4 → itables-2.2.0}/src/itables/logo/logo.svg +0 -0
  126. {itables-2.1.4 → itables-2.2.0}/src/itables/logo/text.svg +0 -0
  127. {itables-2.1.4 → itables-2.2.0}/src/itables/logo/wide.svg +0 -0
  128. {itables-2.1.4 → itables-2.2.0}/src/itables/logo/with_text.svg +0 -0
  129. {itables-2.1.4 → itables-2.2.0}/src/itables/samples/countries.csv +0 -0
  130. {itables-2.1.4 → itables-2.2.0}/src/itables/samples/indicators.csv +0 -0
  131. {itables-2.1.4 → itables-2.2.0}/src/itables/samples/population.csv +0 -0
  132. {itables-2.1.4 → itables-2.2.0}/tests/conftest.py +0 -0
  133. {itables-2.1.4 → itables-2.2.0}/tests/test_changelog.py +0 -0
  134. {itables-2.1.4 → itables-2.2.0}/tests/test_datatables_format.py +0 -0
  135. {itables-2.1.4 → itables-2.2.0}/tests/test_documentation_notebooks_run.py +0 -0
  136. {itables-2.1.4 → itables-2.2.0}/tests/test_downsample.py +0 -0
  137. {itables-2.1.4 → itables-2.2.0}/tests/test_html_in_table_header.py +0 -0
  138. {itables-2.1.4 → itables-2.2.0}/tests/test_init.py +0 -0
  139. {itables-2.1.4 → itables-2.2.0}/tests/test_json_dumps.py +0 -0
  140. {itables-2.1.4 → itables-2.2.0}/tests/test_notebook.ipynb +0 -0
  141. {itables-2.1.4 → itables-2.2.0}/tests/test_pandas_style.py +0 -0
  142. {itables-2.1.4 → itables-2.2.0}/tests/test_polars.py +0 -0
  143. {itables-2.1.4 → itables-2.2.0}/tests/test_sample_dfs.py +0 -0
@@ -87,6 +87,10 @@ jobs:
87
87
  if: matrix.polars
88
88
  run: pip install -e .[polars]
89
89
 
90
+ - name: Install shiny
91
+ if: matrix.python-version != '3.7'
92
+ run: pip install "shiny>=1.0"
93
+
90
94
  - name: Uninstall jinja2
91
95
  if: matrix.uninstall_jinja2
92
96
  run: pip uninstall jinja2 -y
@@ -30,6 +30,7 @@ jobs:
30
30
  pip install jupyter-book
31
31
  pip install matplotlib # Pandas style
32
32
  pip install .[polars]
33
+ pip install .[widget]
33
34
 
34
35
  - name: Create a kernel
35
36
  run: |
@@ -30,3 +30,6 @@ dt_bundle.css
30
30
 
31
31
  # Streamlit package
32
32
  src/itables/itables_for_streamlit
33
+
34
+ # Jupyter Widget
35
+ src/itables/widget/static
@@ -32,7 +32,7 @@ repos:
32
32
  rev: v1.16.2
33
33
  hooks:
34
34
  - id: jupytext
35
- exclude: dt_for_itables/
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.1.4
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,17 +95,22 @@ 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
  ![ITables logo](https://raw.githubusercontent.com/mwouts/itables/3f8e8bd75af7ad38a500518fcb4fbbc370ea6c4c/itables/logo/wide.svg)
82
106
 
83
- ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
107
+ [![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/mwouts/itables/actions)
84
108
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
85
109
  [![Pypi](https://img.shields.io/pypi/v/itables.svg)](https://pypi.python.org/pypi/itables)
86
110
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/itables.svg)](https://anaconda.org/conda-forge/itables)
87
111
  [![pyversions](https://img.shields.io/pypi/pyversions/itables.svg)](https://pypi.python.org/pypi/itables)
88
112
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
113
+ [![Jupyter Widget](https://img.shields.io/badge/Jupyter-Widget-F37626.svg?style=flat&logo=Jupyter)](https://mwouts.github.io/itables/ipywidgets.html)
89
114
  [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_red.svg)](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
  ![show](docs/show_df.png)
130
155
 
131
- Since `itables==1.0.0`, the [jQuery](https://jquery.com/) and [DataTables](https://datatables.net/) libraries and CSS
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 in
147
- [Streamlit](https://mwouts.github.io/itables/streamlit.html) or
148
- [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
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.
@@ -1,11 +1,12 @@
1
1
  ![ITables logo](https://raw.githubusercontent.com/mwouts/itables/3f8e8bd75af7ad38a500518fcb4fbbc370ea6c4c/itables/logo/wide.svg)
2
2
 
3
- ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
3
+ [![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/mwouts/itables/actions)
4
4
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
5
5
  [![Pypi](https://img.shields.io/pypi/v/itables.svg)](https://pypi.python.org/pypi/itables)
6
6
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/itables.svg)](https://anaconda.org/conda-forge/itables)
7
7
  [![pyversions](https://img.shields.io/pypi/pyversions/itables.svg)](https://pypi.python.org/pypi/itables)
8
8
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
9
+ [![Jupyter Widget](https://img.shields.io/badge/Jupyter-Widget-F37626.svg?style=flat&logo=Jupyter)](https://mwouts.github.io/itables/ipywidgets.html)
9
10
  [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_red.svg)](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
  ![show](docs/show_df.png)
50
51
 
51
- Since `itables==1.0.0`, the [jQuery](https://jquery.com/) and [DataTables](https://datatables.net/) libraries and CSS
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 in
67
- [Streamlit](https://mwouts.github.io/itables/streamlit.html) or
68
- [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
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,22 +4,24 @@ 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
13
+ - file: dark_mode
12
14
  - file: quarto
13
15
  - file: downsampling
14
16
  - file: references
15
17
  - file: supported_editors
16
18
  - caption: ITables in Applications
17
19
  chapters:
18
- - file: html_export
19
- - file: dash
20
- - file: shiny
21
- - file: streamlit
22
20
  - file: ipywidgets
21
+ - file: streamlit
22
+ - file: shiny
23
+ - file: dash
24
+ - file: html_export
23
25
  - caption: Contributing to ITables
24
26
  chapters:
25
27
  - file: contributing
@@ -1,6 +1,33 @@
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
+
19
+ 2.1.5 (2024-09-08)
20
+ ------------------
21
+
22
+ **Fixed**
23
+ - DataTables was updated to its latest version (2.1.6)
24
+ - We have added the DateTime extension, required by SearchTime when showing dates ([#288](https://github.com/mwouts/itables/issues/288))
25
+ - We have improved the function that determines whether a dark theme is being used ([#294](https://github.com/mwouts/itables/issues/294))
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))
27
+ - The test on the Shiny app fallbacks to `ui.nav_panel` when `ui.nav` is not available
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))
29
+
30
+
4
31
  2.1.4 (2024-07-03)
5
32
  ------------------
6
33
 
@@ -23,7 +50,7 @@ ITables ChangeLog
23
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)).
24
51
 
25
52
  **Fixed**
26
- - 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))
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))
27
54
 
28
55
 
29
56
  2.1.1 (2024-06-08)
@@ -0,0 +1,28 @@
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
+ # Dark Themes
16
+
17
+ When a notebook or application is rendered using a dark theme, DataTable requires that a `dark`
18
+ class be added to the HTML document. This can be done with the following Javascript snippet:
19
+ ```javascript
20
+ document.documentElement.classList.add('dark');
21
+ ```
22
+
23
+ When ITables is used in a notebook, this is handled by
24
+ `init_notebook_mode` which displays the [`init_datatables.html`](https://github.com/mwouts/itables/blob/main/src/itables/html/init_datatables.html) snippet.
25
+
26
+ Please open a PR if you see how to further improve the
27
+ support of light vs dark themes, and e.g. set the `dark`
28
+ class dynamically when the theme is changed.
@@ -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](#row-selection) extension.
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
+ ```
@@ -14,12 +14,13 @@ kernelspec:
14
14
 
15
15
  ![ITables Logo](../src/itables/logo/text.svg)
16
16
 
17
- ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
17
+ [![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/mwouts/itables/actions)
18
18
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
19
19
  [![Pypi](https://img.shields.io/pypi/v/itables.svg)](https://pypi.python.org/pypi/itables)
20
20
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/itables.svg)](https://anaconda.org/conda-forge/itables)
21
21
  [![pyversions](https://img.shields.io/pypi/pyversions/itables.svg)](https://pypi.python.org/pypi/itables)
22
22
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
23
+ [![Jupyter Widget](https://img.shields.io/badge/Jupyter-Widget-F37626.svg?style=flat&logo=Jupyter)](ipywidgets.md)
23
24
  [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_red.svg)](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).
@@ -0,0 +1,51 @@
1
+ # Streamlit
2
+
3
+ To display Python DataFrames as interactive DataTables in Streamlit applications, use
4
+
5
+ ```
6
+ from itables.streamlit import interactive_table
7
+ ```
8
+
9
+ We have a sample application available at https://itables.streamlit.app (source code [here](https://github.com/mwouts/demo_itables_in_streamlit/blob/main/itables_app.py))
10
+
11
+ ```{div} full-width
12
+ <iframe src="https://itables.streamlit.app?embed=true"
13
+ style="height: 600px; width: 100%;"></iframe>
14
+ ```
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
+
23
+ ## Limitations
24
+
25
+ In most cases, you will be able to use `interactive_table` in a
26
+ Streamlit application in the same way that you use `show` in notebooks.
27
+
28
+ Due to implementation constraints, the Streamlit component has some limitations
29
+ that `show` does not have:
30
+ - Pandas Style objects can't be rendered with `interactive_table`. This is because
31
+ the Streamlit component needs to pass the table data to the frontend in JSON format (while Pandas Style objects are formatted using HTML)
32
+ - Similarly, you can't use the `use_to_html` argument in `interactive_table`
33
+ - Complex column headers might look different than in notebooks, and HTML in columns is not supported
34
+ - JavaScript callbacks like custom formatting functions are not supported
35
+ - The interactive table is rendered within an iframe that has a fixed weight. This does not work well with the `lengthMenu` control, nor with the advanced filtering extensions (if that is an issue for you, please subscribe or contribute to [#275](https://github.com/mwouts/itables/issues/275)).
36
+
37
+ ## Workaround
38
+
39
+ If you hit one of the limitations above, you can fallback to using `to_html_datatable` in combination with Streamlit's `html` function.
40
+
41
+ Please note that:
42
+ - you will have to specify the table height manually,
43
+ - an internet connection is required when using `to_html_datatable`,
44
+ - the app/table might take longer to display.
45
+
46
+ A sample application is available at https://to-html-datatable.streamlit.app (source code [here](https://github.com/mwouts/to_html_datatable_in_streamlit/blob/main/itables_app.py))
47
+
48
+ ```{div} full-width
49
+ <iframe src="https://to-html-datatable.streamlit.app?embed=true"
50
+ style="height: 600px; width: 100%;"></iframe>
51
+ ```
@@ -25,5 +25,6 @@ dependencies:
25
25
  - ghp-import
26
26
  - shiny
27
27
  - streamlit
28
+ - anywidget
28
29
  - pip:
29
30
  - world_bank_data
@@ -1,4 +1,12 @@
1
- # 2.0.11 (2024-06-??)
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
+
5
+ # 2.0.12 (2024-09-08)
6
+
7
+ - We have added the datetime extension for DataTables ([#288](https://github.com/mwouts/itables/issues/288))
8
+
9
+ # 2.0.11 (2024-06-19)
2
10
 
3
11
  **Added**
4
12
  - The default CSS contains has `overflow:auto` on `.dt-layout-table>div`. This improves the horizontal scrolling in Jupyter, and discards the need for `scrollX` in Streamlit ([#282](https://github.com/mwouts/itables/pull/282))
@@ -15,7 +15,7 @@ npm run build:js
15
15
 
16
16
  Run
17
17
  ```bash
18
- npm update
18
+ npm update --save
19
19
  ```
20
20
  and check whether there are any outdated package with `npm outdated`.
21
21