Skip to content

Commit 235a6a9

Browse files
committed
Document the Streamlit extension
and reorganize the documentation
1 parent 4b92aad commit 235a6a9

22 files changed

+270
-110
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ execute `init_notebook_mode`.
5656

5757
## Supported environments
5858

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.

docs/_toc.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
format: jb-book
22
root: quick_start
33
parts:
4-
- caption: How to use DataTables
4+
- caption: ITables in Notebooks
55
chapters:
66
- file: advanced_parameters
7-
- file: formatting
87
- file: custom_css
8+
- file: formatting
9+
- file: pandas_style
910
- file: extensions
1011
- 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
1224
chapters:
13-
- file: supported_editors
14-
- file: quarto
15-
- file: downsampling
16-
- file: references
1725
- file: contributing
1826
- file: developing
1927
- file: troubleshooting
@@ -22,4 +30,3 @@ parts:
2230
chapters:
2331
- file: sample_dataframes
2432
- file: polars_dataframes
25-
- file: pandas_style

docs/advanced_parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kernelspec:
1212
name: itables
1313
---
1414

15-
# The DataTables Arguments
15+
# Advanced Parameters
1616

1717
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/).
1818

docs/contributing.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +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+
115
# Contributing
216

317
Thanks for considering making a contribution to ITables. There are
4-
indeed many ways to help!
18+
many ways you can help!
519

6-
## Reporting an issue
20+
## Report an issue
721

822
If you see an issue, a possible improvement, or if you can't find
923
the answer to your question, then you are very welcome to create
1024
an issue on this project. Please provide enough detail so that
1125
we can reproduce the issue.
1226

13-
## Improving the documentation
27+
## Improve the documentation
1428

1529
If you would like to add a new example,
1630
or improve the documentation, feel free to make a pull request!
1731

1832
You can render the documentation locally - see the section on
1933
[Jupyter Book](developing.md#jupyter-book) in the developer guide.
2034

21-
## Developing a new feature
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
2266

2367
It is generally a good idea to get in touch with us first - e.g.
2468
open an issue and let us know what you'd like to do.
2569

2670
But you can also simply clone the project and test your ideas.
27-
2871
A guide on how to set up a development environment, and how to
2972
run some tests, is available [here](developing.md).

docs/custom_css.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kernelspec:
1212
name: itables
1313
---
1414

15-
# Styling
15+
# Table Style and CSS
1616

1717
As usual, we initialize ITables with `init_notebook_mode`, and we create two sample DataFrames:
1818

@@ -113,7 +113,7 @@ show(df, classes="display nowrap table_with_monospace_font")
113113
The `show` function has a `style` argument that determines the
114114
style for that particular table.
115115

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.
117117
Without `width:auto`, tables with few columns still take the full notebook width in Jupyter.
118118
Using `margin:auto` makes non-wide tables centered in Jupyter.
119119

docs/dash.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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).

docs/extensions.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kernelspec:
1212
name: itables
1313
---
1414

15-
# DataTables Extensions
15+
# Download Buttons and Other Extensions
1616

1717
DataTables comes with a series of [extensions](https://datatables.net/extensions/), which are supported by ITables since v2.0.
1818
A selection of these extensions are included in ITables.
@@ -102,6 +102,11 @@ show(
102102
)
103103
```
104104

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+
105110
```{warning}
106111
The PDF button is not included in ITables' DataTable bundle. This is because the required PDF libraries
107112
have a large footprint on the bundle size. Still, you can add it to your custom bundle, see the next chapter.

docs/formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kernelspec:
1212
name: itables
1313
---
1414

15-
# Formatting
15+
# Cell Formatting
1616

1717
## Formatting with Pandas
1818

docs/html_export.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
```

docs/ipywidgets.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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).

0 commit comments

Comments
 (0)