itables 2.0.1__tar.gz → 2.1.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 (118) hide show
  1. {itables-2.0.1 → itables-2.1.0}/.gitignore +6 -1
  2. {itables-2.0.1 → itables-2.1.0}/.pre-commit-config.yaml +6 -6
  3. {itables-2.0.1 → itables-2.1.0}/PKG-INFO +11 -12
  4. {itables-2.0.1 → itables-2.1.0}/README.md +10 -11
  5. {itables-2.0.1 → itables-2.1.0}/docs/_config.yml +1 -1
  6. {itables-2.0.1 → itables-2.1.0}/docs/_toc.yml +15 -8
  7. {itables-2.0.1 → itables-2.1.0}/docs/advanced_parameters.md +2 -2
  8. {itables-2.0.1 → itables-2.1.0}/docs/changelog.md +12 -0
  9. itables-2.1.0/docs/contributing.md +72 -0
  10. {itables-2.0.1 → itables-2.1.0}/docs/custom_css.md +3 -3
  11. {itables-2.0.1 → itables-2.1.0}/docs/custom_extensions.md +14 -6
  12. itables-2.1.0/docs/dash.md +4 -0
  13. {itables-2.0.1 → itables-2.1.0}/docs/downsampling.md +1 -1
  14. {itables-2.0.1 → itables-2.1.0}/docs/extensions.md +7 -2
  15. {itables-2.0.1 → itables-2.1.0}/docs/formatting.md +2 -2
  16. itables-2.1.0/docs/html_export.md +41 -0
  17. itables-2.1.0/docs/ipywidgets.md +4 -0
  18. {itables-2.0.1 → itables-2.1.0}/docs/pandas_style.md +17 -13
  19. {itables-2.0.1 → itables-2.1.0}/docs/polars_dataframes.md +1 -1
  20. {itables-2.0.1 → itables-2.1.0}/docs/quarto.md +0 -14
  21. {itables-2.0.1 → itables-2.1.0}/docs/quick_start.md +17 -18
  22. {itables-2.0.1 → itables-2.1.0}/docs/sample_dataframes.md +1 -1
  23. itables-2.1.0/docs/shiny.md +14 -0
  24. itables-2.1.0/docs/streamlit.md +42 -0
  25. {itables-2.0.1 → itables-2.1.0}/docs/supported_editors.md +1 -27
  26. {itables-2.0.1 → itables-2.1.0}/docs/troubleshooting.md +7 -1
  27. {itables-2.0.1 → itables-2.1.0}/environment.yml +2 -1
  28. itables-2.1.0/packages/dt_for_itables/CHANGELOG.md +7 -0
  29. {itables-2.0.1/itables → itables-2.1.0/packages}/dt_for_itables/README.md +1 -1
  30. {itables-2.0.1/itables → itables-2.1.0/packages}/dt_for_itables/package-lock.json +113 -113
  31. {itables-2.0.1/itables → itables-2.1.0/packages}/dt_for_itables/package.json +8 -5
  32. itables-2.1.0/packages/dt_for_itables/src/index.d.ts +1 -0
  33. itables-2.0.1/itables/dt_for_itables/src.js → itables-2.1.0/packages/dt_for_itables/src/index.js +2 -0
  34. itables-2.1.0/packages/itables_for_streamlit/README.md +9 -0
  35. itables-2.1.0/packages/itables_for_streamlit/package-lock.json +18068 -0
  36. itables-2.1.0/packages/itables_for_streamlit/package.json +39 -0
  37. itables-2.1.0/packages/itables_for_streamlit/public/index.html +12 -0
  38. itables-2.1.0/packages/itables_for_streamlit/src/index.tsx +40 -0
  39. itables-2.1.0/packages/itables_for_streamlit/tsconfig.json +19 -0
  40. itables-2.1.0/packages/package-lock.json +10 -0
  41. itables-2.1.0/packages/package.json +10 -0
  42. {itables-2.0.1 → itables-2.1.0}/pyproject.toml +9 -5
  43. {itables-2.0.1 → itables-2.1.0/src}/itables/datatables_format.py +23 -8
  44. {itables-2.0.1 → itables-2.1.0/src}/itables/html/datatables_template.html +2 -2
  45. {itables-2.0.1/itables/dt_for_itables → itables-2.1.0/src/itables/html}/dt_bundle.js +9 -9
  46. {itables-2.0.1 → itables-2.1.0/src}/itables/interactive.py +1 -0
  47. itables-2.1.0/src/itables/itables_for_streamlit/asset-manifest.json +13 -0
  48. itables-2.1.0/src/itables/itables_for_streamlit/index.html +1 -0
  49. itables-2.1.0/src/itables/itables_for_streamlit/static/css/main.45cd49da.css +2 -0
  50. itables-2.1.0/src/itables/itables_for_streamlit/static/css/main.45cd49da.css.map +1 -0
  51. itables-2.1.0/src/itables/itables_for_streamlit/static/js/main.b98e79fb.js +3 -0
  52. itables-2.1.0/src/itables/itables_for_streamlit/static/js/main.b98e79fb.js.LICENSE.txt +99 -0
  53. itables-2.1.0/src/itables/itables_for_streamlit/static/js/main.b98e79fb.js.map +1 -0
  54. {itables-2.0.1 → itables-2.1.0/src}/itables/javascript.py +181 -15
  55. {itables-2.0.1 → itables-2.1.0/src}/itables/options.py +5 -2
  56. {itables-2.0.1 → itables-2.1.0/src}/itables/sample_dfs.py +5 -5
  57. itables-2.1.0/src/itables/streamlit.py +13 -0
  58. {itables-2.0.1 → itables-2.1.0/src}/itables/utils.py +1 -1
  59. {itables-2.0.1 → itables-2.1.0/src}/itables/version.py +1 -1
  60. {itables-2.0.1 → itables-2.1.0}/tests/test_datatables_format.py +1 -0
  61. {itables-2.0.1 → itables-2.1.0}/tests/test_documentation_notebooks_run.py +7 -0
  62. itables-2.1.0/tests/test_extension_arguments.py +67 -0
  63. {itables-2.0.1 → itables-2.1.0}/tests/test_javascript.py +1 -1
  64. {itables-2.0.1 → itables-2.1.0}/tests/test_sample_dfs.py +2 -2
  65. {itables-2.0.1 → itables-2.1.0}/tests/test_update_samples.py +1 -1
  66. itables-2.0.1/docs/contributing.md +0 -29
  67. {itables-2.0.1 → itables-2.1.0}/.github/workflows/comment-pr.yml +0 -0
  68. {itables-2.0.1 → itables-2.1.0}/.github/workflows/continuous-integration.yml +0 -0
  69. {itables-2.0.1 → itables-2.1.0}/.github/workflows/publish-book.yml +0 -0
  70. {itables-2.0.1 → itables-2.1.0}/.github/workflows/publish.yml +0 -0
  71. {itables-2.0.1 → itables-2.1.0}/.pylintrc +0 -0
  72. {itables-2.0.1 → itables-2.1.0}/LICENSE +0 -0
  73. {itables-2.0.1 → itables-2.1.0}/binder/labconfig/default_setting_overrides.json +0 -0
  74. {itables-2.0.1 → itables-2.1.0}/binder/postBuild +0 -0
  75. {itables-2.0.1 → itables-2.1.0}/binder/requirements.txt +0 -0
  76. {itables-2.0.1 → itables-2.1.0}/codecov.yml +0 -0
  77. {itables-2.0.1 → itables-2.1.0}/docs/developing.md +0 -0
  78. {itables-2.0.1 → itables-2.1.0}/docs/df_example.png +0 -0
  79. {itables-2.0.1 → itables-2.1.0}/docs/images/code.png +0 -0
  80. {itables-2.0.1 → itables-2.1.0}/docs/images/colab.png +0 -0
  81. {itables-2.0.1 → itables-2.1.0}/docs/images/html.png +0 -0
  82. {itables-2.0.1 → itables-2.1.0}/docs/images/lab.png +0 -0
  83. {itables-2.0.1 → itables-2.1.0}/docs/images/notebook.png +0 -0
  84. {itables-2.0.1 → itables-2.1.0}/docs/images/pycharm.png +0 -0
  85. {itables-2.0.1 → itables-2.1.0}/docs/quarto/quarto_html.qmd +0 -0
  86. {itables-2.0.1 → itables-2.1.0}/docs/quarto/quarto_revealjs.qmd +0 -0
  87. {itables-2.0.1 → itables-2.1.0}/docs/references.md +0 -0
  88. {itables-2.0.1 → itables-2.1.0}/docs/show_df.png +0 -0
  89. {itables-2.0.1/itables → itables-2.1.0/packages}/dt_for_itables/LICENSE +0 -0
  90. {itables-2.0.1 → itables-2.1.0/src}/itables/__init__.py +0 -0
  91. {itables-2.0.1 → itables-2.1.0/src}/itables/downsample.py +0 -0
  92. {itables-2.0.1 → itables-2.1.0/src}/itables/html/column_filters/initComplete.js +0 -0
  93. {itables-2.0.1 → itables-2.1.0/src}/itables/html/column_filters/pre_dt_code.js +0 -0
  94. {itables-2.0.1/itables/dt_for_itables → itables-2.1.0/src/itables/html}/dt_bundle.css +0 -0
  95. {itables-2.0.1 → itables-2.1.0/src}/itables/html/init_datatables.html +0 -0
  96. {itables-2.0.1 → itables-2.1.0/src}/itables/logo/loading.svg +0 -0
  97. {itables-2.0.1 → itables-2.1.0/src}/itables/logo/logo.svg +0 -0
  98. {itables-2.0.1 → itables-2.1.0/src}/itables/logo/text.svg +0 -0
  99. {itables-2.0.1 → itables-2.1.0/src}/itables/logo/wide.svg +0 -0
  100. {itables-2.0.1 → itables-2.1.0/src}/itables/logo/with_text.svg +0 -0
  101. {itables-2.0.1 → itables-2.1.0/src}/itables/samples/countries.csv +0 -0
  102. {itables-2.0.1 → itables-2.1.0/src}/itables/samples/indicators.csv +0 -0
  103. {itables-2.0.1 → itables-2.1.0/src}/itables/samples/population.csv +0 -0
  104. {itables-2.0.1 → itables-2.1.0/src}/itables/shiny.py +0 -0
  105. {itables-2.0.1 → itables-2.1.0}/tests/__init__.py +0 -0
  106. {itables-2.0.1 → itables-2.1.0}/tests/conftest.py +0 -0
  107. {itables-2.0.1 → itables-2.1.0}/tests/sample_python_apps/itables_in_a_shiny_app.py +0 -0
  108. {itables-2.0.1 → itables-2.1.0}/tests/sample_python_apps/itables_in_a_shiny_app_with_tabs.py +0 -0
  109. {itables-2.0.1 → itables-2.1.0}/tests/test_changelog.py +0 -0
  110. {itables-2.0.1 → itables-2.1.0}/tests/test_connected_notebook_is_small.py +0 -0
  111. {itables-2.0.1 → itables-2.1.0}/tests/test_downsample.py +0 -0
  112. {itables-2.0.1 → itables-2.1.0}/tests/test_html_in_table_header.py +0 -0
  113. {itables-2.0.1 → itables-2.1.0}/tests/test_init.py +0 -0
  114. {itables-2.0.1 → itables-2.1.0}/tests/test_json_dumps.py +0 -0
  115. {itables-2.0.1 → itables-2.1.0}/tests/test_notebook.ipynb +0 -0
  116. {itables-2.0.1 → itables-2.1.0}/tests/test_pandas_style.py +0 -0
  117. {itables-2.0.1 → itables-2.1.0}/tests/test_polars.py +0 -0
  118. {itables-2.0.1 → itables-2.1.0}/tests/test_sample_python_apps.py +0 -0
@@ -21,7 +21,12 @@ _build
21
21
  docs/quarto/*.html
22
22
  docs/quarto/*_files/
23
23
 
24
- # DataTables bundle
24
+ # Node packages
25
25
  node_modules
26
+
27
+ # DataTables bundle
26
28
  dt_bundle.js
27
29
  dt_bundle.css
30
+
31
+ # Streamlit package
32
+ src/itables/itables_for_streamlit
@@ -4,7 +4,7 @@
4
4
  repos:
5
5
 
6
6
  - repo: https://github.com/pre-commit/pre-commit-hooks
7
- rev: v4.4.0
7
+ rev: v4.6.0
8
8
  hooks:
9
9
  - id: check-json
10
10
  - id: check-yaml
@@ -18,24 +18,24 @@ repos:
18
18
  args: ["--profile", "black", "--filter-files"]
19
19
 
20
20
  - repo: https://github.com/psf/black
21
- rev: 22.3.0
21
+ rev: 24.4.2
22
22
  hooks:
23
23
  - id: black
24
24
 
25
25
  - repo: https://github.com/astral-sh/ruff-pre-commit
26
- rev: v0.3.1
26
+ rev: v0.4.5
27
27
  hooks:
28
28
  - id: ruff
29
29
  args: ["--fix", "--show-fixes"]
30
30
 
31
31
  - repo: https://github.com/mwouts/jupytext
32
- rev: v1.14.5
32
+ rev: v1.16.2
33
33
  hooks:
34
34
  - id: jupytext
35
35
  exclude: dt_for_itables/
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:
39
- - black==22.3.0 # Matches hook
40
- - ruff==0.3.1
39
+ - black==24.4.2 # Matches hook
40
+ - ruff==0.4.3
41
41
  - isort==5.13.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: itables
3
- Version: 2.0.1
3
+ Version: 2.1.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
@@ -78,7 +78,7 @@ Requires-Dist: shiny; extra == 'test'
78
78
  Requires-Dist: world-bank-data; extra == 'test'
79
79
  Description-Content-Type: text/markdown
80
80
 
81
- ![ITables Logo](itables/logo/wide.svg)
81
+ ![ITables logo](https://raw.githubusercontent.com/mwouts/itables/3f8e8bd75af7ad38a500518fcb4fbbc370ea6c4c/itables/logo/wide.svg)
82
82
 
83
83
  ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
84
84
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
@@ -136,13 +136,12 @@ execute `init_notebook_mode`.
136
136
 
137
137
  ## Supported environments
138
138
 
139
- `itables` has been tested in the following editors:
140
- - Jupyter Notebook
141
- - Jupyter Lab
142
- - Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook)
143
- - Jupyter Book
144
- - Google Colab
145
- - VS Code (for both Jupyter Notebooks and Python scripts)
146
- - PyCharm (for Jupyter Notebooks)
147
- - Quarto
148
- - Shiny for Python
139
+ ITables works in all the usual Jupyter Notebook environments, including Jupyter Notebook, Jupyter Lab, Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook), Jupyter Book, Google Colab and Kaggle.
140
+
141
+ You can also use ITables in [Quarto](https://mwouts.github.io/itables/quarto.html) HTML documents, and in RISE presentations.
142
+
143
+ ITables works well in VS Code, both in Jupyter Notebooks and in interactive Python sessions.
144
+
145
+ Last but not least, ITables is also available in
146
+ [Streamlit](https://mwouts.github.io/itables/streamlit.html) or
147
+ [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
@@ -1,4 +1,4 @@
1
- ![ITables Logo](itables/logo/wide.svg)
1
+ ![ITables logo](https://raw.githubusercontent.com/mwouts/itables/3f8e8bd75af7ad38a500518fcb4fbbc370ea6c4c/itables/logo/wide.svg)
2
2
 
3
3
  ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
4
4
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
@@ -56,13 +56,12 @@ execute `init_notebook_mode`.
56
56
 
57
57
  ## Supported environments
58
58
 
59
- `itables` has been tested in the following editors:
60
- - Jupyter Notebook
61
- - Jupyter Lab
62
- - Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook)
63
- - Jupyter Book
64
- - Google Colab
65
- - VS Code (for both Jupyter Notebooks and Python scripts)
66
- - PyCharm (for Jupyter Notebooks)
67
- - Quarto
68
- - Shiny for Python
59
+ ITables works in all the usual Jupyter Notebook environments, including Jupyter Notebook, Jupyter Lab, Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook), Jupyter Book, Google Colab and Kaggle.
60
+
61
+ You can also use ITables in [Quarto](https://mwouts.github.io/itables/quarto.html) HTML documents, and in RISE presentations.
62
+
63
+ ITables works well in VS Code, both in Jupyter Notebooks and in interactive Python sessions.
64
+
65
+ Last but not least, ITables is also available in
66
+ [Streamlit](https://mwouts.github.io/itables/streamlit.html) or
67
+ [Shiny](https://mwouts.github.io/itables/shiny.html) applications.
@@ -1,7 +1,7 @@
1
1
  title: Interactive Tables
2
2
  author: Marc Wouts
3
3
  copyright: "2019-2024"
4
- logo: "../itables/logo/logo.svg"
4
+ logo: "../src/itables/logo/logo.svg"
5
5
  execute:
6
6
  execute_notebooks: force
7
7
  sphinx:
@@ -1,19 +1,27 @@
1
1
  format: jb-book
2
2
  root: quick_start
3
3
  parts:
4
- - caption: How to use DataTables
4
+ - caption: ITables in Notebooks
5
5
  chapters:
6
6
  - file: advanced_parameters
7
- - file: formatting
8
7
  - file: custom_css
8
+ - file: formatting
9
+ - file: pandas_style
9
10
  - file: extensions
10
11
  - file: custom_extensions
11
- - caption: ITables
12
+ - file: quarto
13
+ - file: downsampling
14
+ - file: references
15
+ - file: supported_editors
16
+ - caption: ITables in Applications
17
+ chapters:
18
+ - file: html_export
19
+ - file: dash
20
+ - file: shiny
21
+ - file: streamlit
22
+ - file: ipywidgets
23
+ - caption: Contributing to ITables
12
24
  chapters:
13
- - file: supported_editors
14
- - file: quarto
15
- - file: downsampling
16
- - file: references
17
25
  - file: contributing
18
26
  - file: developing
19
27
  - file: troubleshooting
@@ -22,4 +30,3 @@ parts:
22
30
  chapters:
23
31
  - file: sample_dataframes
24
32
  - file: polars_dataframes
25
- - file: pandas_style
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- # The DataTables Arguments
15
+ # Advanced Parameters
16
16
 
17
17
  ITables is a wrapper for the Javascript [DataTables](https://datatables.net/) library, which has a great [documentation](https://datatables.net/), a huge collection of [examples](https://datatables.net/examples/index), and a useful [forum](https://datatables.net/forums/).
18
18
 
@@ -1,6 +1,18 @@
1
1
  ITables ChangeLog
2
2
  =================
3
3
 
4
+ 2.1.0 (2024-05-27)
5
+ ------------------
6
+
7
+ **Added**
8
+ - ITables works with Streamlit ([#270](https://github.com/mwouts/itables/pull/270))
9
+
10
+ **Changed**
11
+ - ITables now uses the `src` layout ([#246](https://github.com/mwouts/itables/issues/246)) - many thanks to [Mahendra Paipuri](https://github.com/mahendrapaipuri) for his help on this topic!
12
+ - We have updated `dt_for_itables`' dependencies to `datatables.net-dt==2.0.7` and `datatables.net-select-dt==2.0.2` ([#273](https://github.com/mwouts/itables/pull/273))
13
+ - We have updated the pre-commit hooks used in the project ([#268](https://github.com/mwouts/itables/pull/268))
14
+
15
+
4
16
  2.0.1 (2024-04-30)
5
17
  ------------------
6
18
 
@@ -0,0 +1,72 @@
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
+ # Contributing
16
+
17
+ Thanks for considering making a contribution to ITables. There are
18
+ many ways you can help!
19
+
20
+ ## Report an issue
21
+
22
+ If you see an issue, a possible improvement, or if you can't find
23
+ the answer to your question, then you are very welcome to create
24
+ an issue on this project. Please provide enough detail so that
25
+ we can reproduce the issue.
26
+
27
+ ## Improve the documentation
28
+
29
+ If you would like to add a new example,
30
+ or improve the documentation, feel free to make a pull request!
31
+
32
+ You can render the documentation locally - see the section on
33
+ [Jupyter Book](developing.md#jupyter-book) in the developer guide.
34
+
35
+ ## Give credit to ITables
36
+
37
+ It's always great to see new stars coming to ITables! <a class="github-button" href="https://github.com/mwouts/itables" data-icon="octicon-star" data-show-count="true"></a>
38
+ <script src="https://buttons.github.io/buttons.js"></script>
39
+
40
+ If you wanted to share a link to ITables and DataTables (no obligation whatsoever), you could use something like this:
41
+
42
+ ```{code-cell}
43
+ from IPython.display import HTML, display
44
+
45
+ display(
46
+ HTML(
47
+ """
48
+ Tables displayed with <a href=https://mwouts.github.io/itables/>ITables</a>,
49
+ a Python wrapper for <a href=https://datatables.net>DataTables</a>
50
+ """
51
+ )
52
+ )
53
+ ```
54
+
55
+ ## Support DataTables
56
+
57
+ Allan Jardine, the main developer of DataTables, has done a fantastic work on [DataTables](https://datatables.net/).
58
+
59
+ If you enjoy his library, you could become a
60
+ [supporter](https://datatables.net/supporters/) -
61
+ contributions range from 9 to 99$/year before VAT.
62
+ Or you could take a subscription for DataTable's [Editor](https://editor.datatables.net)
63
+ that ITables might support in the future (please subscribe to [#243](https://github.com/mwouts/itables/issues/243) for updates).
64
+
65
+ ## Develop a new feature
66
+
67
+ It is generally a good idea to get in touch with us first - e.g.
68
+ open an issue and let us know what you'd like to do.
69
+
70
+ But you can also simply clone the project and test your ideas.
71
+ A guide on how to set up a development environment, and how to
72
+ run some tests, is available [here](developing.md).
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- # Styling
15
+ # Table Style and CSS
16
16
 
17
17
  As usual, we initialize ITables with `init_notebook_mode`, and we create two sample DataFrames:
18
18
 
@@ -113,7 +113,7 @@ show(df, classes="display nowrap table_with_monospace_font")
113
113
  The `show` function has a `style` argument that determines the
114
114
  style for that particular table.
115
115
 
116
- The default value for `style` is `table-layout:auto;width:auto;margin:auto;caption-side:bottom`.
116
+ The default value for `style` is `"table-layout:auto;width:auto;margin:auto;caption-side:bottom"`. When `scrollX` is `True`, `margin:auto` gets replaced with `margin:0` to avoid misaligned headers.
117
117
  Without `width:auto`, tables with few columns still take the full notebook width in Jupyter.
118
118
  Using `margin:auto` makes non-wide tables centered in Jupyter.
119
119
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
@@ -53,18 +53,26 @@ To use custom extensions in the offline mode, you will need
53
53
  to create a bundle of jQuery, DataTables, and the desired extensions.
54
54
 
55
55
  To do so, make a copy of
56
- [`itables/dt_for_itables`](https://github.com/mwouts/itables/tree/main/itables/dt_for_itables):
56
+ [`packages/dt_for_itables`](https://github.com/mwouts/itables/tree/main/packages/dt_for_itables):
57
57
  ```bash
58
- $ ls itables/dt_for_itables/
59
- package.json package-lock.json README.md src.js
58
+ $ tree
59
+ ```
60
+ ```
61
+ .
62
+ ├── LICENSE
63
+ ├── package.json
64
+ ├── package-lock.json
65
+ ├── README.md
66
+ └── src
67
+ └── index.js
60
68
  ```
61
69
 
62
- Add or remove the desired extensions in `package.json` and `src.js`. To do this,
70
+ Add or remove the desired extensions in `package.json` and `src/index.js`. To do this,
63
71
  you can use the [DataTables download](https://datatables.net/download/) page and
64
72
  follow the instructions for the _NPM_ download method.
65
73
 
66
74
  For instance, say you want to bundle the PDF export button. Change
67
- `src.js` to this code:
75
+ `src/index.js` to this code:
68
76
  ```javascript
69
77
  import JSZip from 'jszip';
70
78
  import jQuery from 'jquery';
@@ -0,0 +1,4 @@
1
+ # Dash
2
+
3
+ ITables does not have a [Dash](https://dash.plotly.com/) component, but might get one in the future.
4
+ You are welcome to subscribe or contribute to [#245](https://github.com/mwouts/itables/issues/245).
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- # DataTables Extensions
15
+ # Download Buttons and Other Extensions
16
16
 
17
17
  DataTables comes with a series of [extensions](https://datatables.net/extensions/), which are supported by ITables since v2.0.
18
18
  A selection of these extensions are included in ITables.
@@ -102,6 +102,11 @@ show(
102
102
  )
103
103
  ```
104
104
 
105
+ ```{warning}
106
+ At the moment, the CSV and Excel buttons don't work well with large tables in some browsers.
107
+ Please subscribe to [#251](https://github.com/mwouts/itables/issues/251) if you wish to receive updates on this.
108
+ ```
109
+
105
110
  ```{warning}
106
111
  The PDF button is not included in ITables' DataTable bundle. This is because the required PDF libraries
107
112
  have a large footprint on the bundle size. Still, you can add it to your custom bundle, see the next chapter.
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- # Formatting
15
+ # Cell Formatting
16
16
 
17
17
  ## Formatting with Pandas
18
18
 
@@ -0,0 +1,41 @@
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
+ # HTML export
16
+
17
+ To get the HTML representation of a Pandas DataFrame `df` as an interactive [DataTable](https://datatables.net/), you can use `to_html_datatable` as below:
18
+
19
+ ```{code-cell}
20
+ from IPython.display import HTML, display
21
+
22
+ from itables import to_html_datatable
23
+ from itables.sample_dfs import get_countries
24
+
25
+ df = get_countries(html=False)
26
+ html = to_html_datatable(df.head(3), display_logo_when_loading=False)
27
+ ```
28
+
29
+ You can then save the `html` variable to a text file (note: if you're writing an HTML application, you could consider using [Shiny](shiny.md) or [Streamlit](streamlit.md) instead), or print it:
30
+
31
+ ```{code-cell}
32
+ :tags: [scroll-output]
33
+
34
+ print(html)
35
+ ```
36
+
37
+ or display it, like `show` does:
38
+
39
+ ```{code-cell}
40
+ display(HTML(html))
41
+ ```
@@ -0,0 +1,4 @@
1
+ # IPyWidgets
2
+
3
+ ITables does not come as a [Jupyter Widget](https://ipywidgets.readthedocs.io) at the moment.
4
+ You are welcome to subscribe or contribute to [#267](https://github.com/mwouts/itables/issues/267).
@@ -1,22 +1,37 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- # Pandas Style examples
15
+ # Using Pandas Style
16
16
 
17
17
  Starting with `itables>=1.6.0`, ITables provides support for
18
18
  [Pandas Style](https://pandas.pydata.org/docs/user_guide/style.html).
19
19
 
20
+ ```{note}
21
+ Unlike Pandas or Polar DataFrames, `Styler` objects are rendered directly using their
22
+ `to_html` method, rather than passing the underlying table data to the DataTables
23
+ library.
24
+
25
+ Because of this, the rendering of the table might differ slightly from the rendering of the
26
+ corresponding DataFrame. In particular,
27
+ - The downsampling is not available - please pay attention to the size of the table being rendered
28
+ - Sorting of numbers will not work if the column contains NaNs.
29
+ ```
30
+
31
+ ```{warning}
32
+ Pandas Style objects can't be used with the [Streamlit extension](streamlit.md) for ITables.
33
+ ```
34
+
20
35
  ```{code-cell}
21
36
  import numpy as np
22
37
  import pandas as pd
@@ -83,14 +98,3 @@ ttips = pd.DataFrame(
83
98
  )
84
99
  s.set_tooltips(ttips).set_caption("With tooltips")
85
100
  ```
86
-
87
- ```{note}
88
- Unlike Pandas or Polar DataFrames, `Styler` objects are rendered directly using their
89
- `to_html` method, rather than passing the underlying table data to the DataTables
90
- library.
91
-
92
- Because of this, the rendering of the table might differ slightly from the rendering of the
93
- corresponding DataFrame. In particular,
94
- - The downsampling is not available - please pay attention to the size of the table being rendered
95
- - Sorting of numbers will not work if the column contains NaNs.
96
- ```
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
@@ -1,17 +1,3 @@
1
- ---
2
- jupytext:
3
- formats: md:myst
4
- text_representation:
5
- extension: .md
6
- format_name: myst
7
- format_version: 0.13
8
- jupytext_version: 1.14.5
9
- kernelspec:
10
- display_name: itables
11
- language: python
12
- name: itables
13
- ---
14
-
15
1
  # Quarto
16
2
 
17
3
  ITables works well with the `revealjs` and `html` outputs formats of [Quarto](https://quarto.org).
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python
12
12
  name: itables
13
13
  ---
14
14
 
15
- ![ITables Logo](../itables/logo/text.svg)
15
+ ![ITables Logo](../src/itables/logo/text.svg)
16
16
 
17
17
  ![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
18
18
  [![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
@@ -20,8 +20,8 @@ kernelspec:
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
- <a class="github-button" href="https://github.com/mwouts/itables" data-icon="octicon-star" data-show-count="true" aria-label="Star mwouts/itables on GitHub">Star</a>
24
- <script async defer src="https://buttons.github.io/buttons.js"></script>
23
+ <a class="github-button" href="https://github.com/mwouts/itables" data-icon="octicon-star" data-show-count="true"></a>
24
+ <script src="https://buttons.github.io/buttons.js"></script>
25
25
 
26
26
  This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
27
27
  With `itables` you can display your tables as interactive [DataTables](https://datatables.net/)
@@ -49,9 +49,9 @@ or
49
49
  conda install itables -c conda-forge
50
50
  ```
51
51
 
52
- ## Activate ITables
52
+ ## Activate ITables in a Notebook
53
53
 
54
- Activate the interactive mode for all series and dataframes with
54
+ Activate the interactive mode in notebook-like environment with `init_notebook_mode`:
55
55
 
56
56
  ```{code-cell}
57
57
  from itables import init_notebook_mode
@@ -70,6 +70,16 @@ df = get_countries(html=False)
70
70
  df
71
71
  ```
72
72
 
73
+ If you prefer to render only certain tables using `itables`, or want
74
+ to pass [advanced parameters](advanced_parameters.md) along with the
75
+ DataFrame, use `show`:
76
+
77
+ ```{code-cell}
78
+ from itables import show
79
+
80
+ show(df, lengthMenu=[2, 5, 10, 25, 50, 100, 250])
81
+ ```
82
+
73
83
  ## Offline mode versus connected mode
74
84
 
75
85
  ITables use two Javascript libraries:
@@ -85,17 +95,6 @@ To do so, add the argument `connected=True` when you
85
95
  execute `init_notebook_mode`. This will also make your notebook lighter by
86
96
  about [700kB](https://github.com/mwouts/itables/blob/main/tests/test_connected_notebook_is_small.py).
87
97
 
88
- ## Using ITables for specific tables only
89
-
90
- If you prefer to render only certain series or dataframes using `itables`,
91
- then call `init_notebook_mode(all_interactive=False)` then `show`:
92
-
93
- ```{code-cell}
94
- from itables import show
95
-
96
- show(df, lengthMenu=[2, 5, 10, 25, 50, 100, 250])
97
- ```
98
-
99
98
  ## Try ITables on Binder
100
99
 
101
- You can run our examples notebooks directly on [![Lab](https://img.shields.io/badge/Binder-JupyterLab-blue.svg)](https://mybinder.org/v2/gh/mwouts/itables/main?urlpath=lab/tree/docs/quick_start.md), without having to install anything on your side.
100
+ You can run the examples above (or any other documentation page) directly on ![Lab](https://img.shields.io/badge/Binder-JupyterLab-blue.svg), without having to install anything on your end - just click on the rocket icon at the top of the page.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  jupytext:
3
3
  formats: md:myst
4
+ notebook_metadata_filter: -jupytext.text_representation.jupytext_version
4
5
  text_representation:
5
6
  extension: .md
6
7
  format_name: myst
7
8
  format_version: 0.13
8
- jupytext_version: 1.14.5
9
9
  kernelspec:
10
10
  display_name: itables
11
11
  language: python