Skip to content

Commit cc816e9

Browse files
mwoutsfwouts
andauthored
Offline mode (#77)
* Implement the offline mode * Import jquery from code.jquery.com and dt from cdn.datatables.net * Update documentation and move the changelog there Co-authored-by: François Wouts <[email protected]>
1 parent 2862a8b commit cc816e9

22 files changed

+435
-229
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ jobs:
5757
flake8 itables tests
5858
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
5959
flake8 . --count --exit-zero --max-complexity=10 --statistics
60+
- name: Install a development version of 'itables'
61+
run: pip install -e .
6062
- name: Install a Jupyter Kernel
61-
run: python -m ipykernel install --name itables-dev --user
63+
run: python -m ipykernel install --name itables --user
6264
- name: Test with pytest
6365
run: pytest --cov=./ --cov-report=xml
6466
- name: Upload coverage

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ dist
1414

1515
# Jupyter Book
1616
_build
17+
18+
# External dependencies
19+
itables/external

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exclude: >
1010
repos:
1111

1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v4.1.0
13+
rev: v4.3.0
1414
hooks:
1515
- id: check-json
1616
- id: check-yaml
@@ -34,7 +34,7 @@ repos:
3434
- id: black
3535

3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v2.31.1
37+
rev: v2.34.0
3838
hooks:
3939
- id: pyupgrade
4040
args: ["--py36-plus"]

CHANGELOG.md

Lines changed: 0 additions & 147 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ init_notebook_mode(all_interactive=True)
2020
```
2121
or use `itables.show` to show just one Series or DataFrame as an interactive table.
2222

23-
(NB: In Jupyter Notebook, Jupyter NBconvert and Jupyter Book, you need to call `init_notebook_mode()` before using `show`).
23+
Since `itables==1.0.0`, the [jquery](https://jquery.com/) and [datatables.net](https://datatables.net/) libraries and CSS
24+
are injected in the notebook when you execute `init_notebook_mode` with its default argument `connected=False`.
25+
Thanks to this the interactive tables will work even without a connection to the internet.
26+
27+
If you prefer to load the libraries dynamically (and keep the notebook lighter), use `connected=True` when you
28+
execute `init_notebook_mode`.
2429

2530
## Documentation
2631

@@ -47,9 +52,15 @@ You can run our examples notebooks directly on [![Lab](https://img.shields.io/ba
4752

4853
If the table just says "Loading...", then maybe
4954
- You loaded a notebook that is not trusted (run "Trust Notebook" in View / Activate Command Palette)
50-
- Or you are offline?
55+
- You forgot to run `init_notebook_mode`, or you deleted that cell or its output
56+
- Or you ran `init_notebook_mode(connected=True)` but you are not connected to the internet?
57+
58+
Please note that if you change the value of the `connected` argument in
59+
the `init_notebook_mode` cell, you will need to re-execute all the cells
60+
that display interactive tables.
5161

52-
At the moment `itables` does not have an [offline mode](https://github.com/mwouts/itables/issues/8). While the table data is embedded in the notebook, the `jquery` and `datatables.net` are loaded from a CDN, see our [require.config](https://github.com/mwouts/itables/blob/main/itables/javascript/load_datatables_connected.js) and our [table template](https://github.com/mwouts/itables/blob/main/itables/datatables_template.html), so an internet connection is required to display the tables.
62+
If the above does not help, please check out the [ChangeLog](docs/changelog.md)
63+
and decide whether you should upgrade `itables`.
5364

5465
## <a name="downsampling"></a> Downsampling
5566

docs/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ chapters:
88
- file: references
99
- file: developing
1010
- file: troubleshooting
11+
- file: changelog

docs/changelog.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
ITables ChangeLog
2+
=================
3+
4+
1.0.0 (2022-06-22)
5+
------------------
6+
7+
**Added**
8+
- ITables works offline! ([#8](https://github.com/mwouts/jupytext/issues/8), [#70](https://github.com/mwouts/jupytext/issues/70)). Marc would like to thank
9+
[Allan Jardine](https://sprymedia.co.uk/), the author of the [datatables](https://datatables.net/) library,
10+
and [François Wouts](https://github.com/fwouts) for their precious help on the subject.
11+
12+
13+
**Changed**
14+
- ITables uses the ESM version 1.12.1 of datatables.net
15+
16+
17+
0.4.7 (2022-04-13)
18+
------------------
19+
20+
**Added**
21+
- Additional `tags` like e.g. captions are supported ([#10](https://github.com/mwouts/jupytext/issues/10)).
22+
23+
24+
0.4.6 (2022-03-29)
25+
------------------
26+
27+
**Changed**
28+
- We have removed the default column width at 70 pixels ([#61](https://github.com/mwouts/jupytext/issues/61), [#62](https://github.com/mwouts/jupytext/issues/62), [#66](https://github.com/mwouts/jupytext/issues/66))
29+
- We now use `pyupgrade` in our pre-commit hooks
30+
31+
**Fixed**
32+
- We have improved the rendering of multiindex columns ([#63](https://github.com/mwouts/jupytext/issues/63))
33+
34+
35+
0.4.5 (2022-01-25)
36+
------------------
37+
38+
**Changed**
39+
- The `itables` documentation now uses Jupyter Book ([#56](https://github.com/mwouts/jupytext/issues/56))
40+
- We have added a new `style` option in `itables.options` and in `show`, with a default value equal to `max-width:100%`.
41+
42+
43+
0.4.4 (2022-01-10)
44+
------------------
45+
46+
**Fixed**
47+
- Add 'require_config.js' to the pip package ([#48](https://github.com/mwouts/jupytext/issues/48))
48+
49+
50+
0.4.3 (2022-01-08)
51+
------------------
52+
53+
**Changed**
54+
- When a JS function is created on the Python side, we export it as-is (without quotes) in the HTML file and don't use JS eval anymore.
55+
56+
57+
0.4.2 (2022-01-07)
58+
------------------
59+
60+
**Fixed**
61+
- Fix the HTML output when `eval_functions=True`
62+
- Display "Loading..." under the table header until the table is displayed with datatables.net
63+
- `init_notebook_mode(all_interactive=False)` restores the original Pandas HTML representation.
64+
65+
0.4.1 (2022-01-06)
66+
------------------
67+
68+
**Fixed**
69+
- Long column names don't overlap anymore ([#28](https://github.com/mwouts/jupytext/issues/28))
70+
71+
72+
0.4.0 (2022-01-06)
73+
------------------
74+
75+
r**Fixed**
76+
- Now `itables` also works in Jupyter Lab, Colab, VS Code and PyCharm ([#3](https://github.com/mwouts/jupytext/issues/3), [#4](https://github.com/mwouts/jupytext/issues/4), [#26](https://github.com/mwouts/jupytext/issues/26), [#40](https://github.com/mwouts/jupytext/issues/40)), as we load the `datatables.net` library with an ES import when `require.js` is not available. Many thanks to [François Wouts](https://github.com/fwouts) for his precious help!
77+
78+
**Changed**
79+
- The `show` function (and `itables.options`) has a new argument `eval_functions`. When set to `True`, the nested strings passed to `datatables.net` that start with `function` are converted to Javascript functions.
80+
- The HTML code for the datatables.net representation of the table is generated with an HTML template.
81+
- We use f-strings and thus require Python >= 3.6
82+
83+
84+
0.3.1 (2021-12-24)
85+
------------------
86+
87+
**Fixed**
88+
- We fixed an issue (`jquery` not found) with the HTML export when using `nbconvert>=6.0` ([#21](https://github.com/mwouts/jupytext/issues/21))
89+
- We documented how to change the default ordering of rows - with the `order` option ([#30](https://github.com/mwouts/jupytext/issues/30))
90+
- We documented how to load `require` in Jupyter Lab ([#3](https://github.com/mwouts/jupytext/issues/3))
91+
92+
**Changed**
93+
- The main branch for the project is `main` rather than `master`
94+
- Updated `datatables` to 1.11.3 and `jquery` to 3.5.1
95+
96+
97+
0.3.0 (2020-12-14)
98+
------------------
99+
100+
**Fixed**
101+
- `itables` now has an explicit `init_notebook_mode` function, which inserts the datatables.net library in the notebook. Use `init_notebook_mode(all_interactive=True)` to display all the pandas object as interactive tables. This fixes ([#6](https://github.com/mwouts/jupytext/issues/6)) and ([#17](https://github.com/mwouts/jupytext/issues/17)).
102+
103+
**Changed**
104+
- `itables` uses GitHub Actions for the CI.
105+
106+
**Added**
107+
- `itables` is tested with Python 3.9 as well.
108+
109+
110+
0.2.2 (2020-10-01)
111+
------------------
112+
113+
**Fixed**
114+
- Pandas' `display.max_columns` can be `None`, by Arthur Deygin ([#14](https://github.com/mwouts/jupytext/issues/14))
115+
116+
117+
0.2.1 (2019-11-21)
118+
------------------
119+
120+
**Added**
121+
- Animated screenshot in README
122+
123+
**Fixed**
124+
- Add IPython to setup.py install_requires, by Jon Shao ([#9](https://github.com/mwouts/jupytext/issues/9))
125+
126+
127+
0.2.0 (2019-11-20)
128+
------------------
129+
130+
**Added**
131+
- Large tables are downsampled ([#2](https://github.com/mwouts/jupytext/issues/2))
132+
133+
**Changed**
134+
- Javascript code moved to Javascript files
135+
136+
**Fixed**
137+
- Tables with many columns are now well rendered ([#5](https://github.com/mwouts/jupytext/issues/5))
138+
139+
140+
0.1.0 (2019-04-23)
141+
------------------
142+
143+
Initial release

docs/developing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mamba env update --file environment.yml
1313

1414
Then, activate that environment with
1515
```shell
16-
conda activate itables-dev
16+
conda activate itables
1717
```
1818

1919
Install the pre-commit hooks with
@@ -35,7 +35,11 @@ pytest
3535

3636
The `itables` documentation uses [Jupyter Book](https://jupyterbook.org/).
3737

38-
To build the documentation locally, use
38+
To build the documentation locally, create a kernel named `itables` with
39+
```shell
40+
python -m ipykernel install --name itables --user
41+
```
42+
and then build the documentation with
3943
```
4044
jupyter-book build docs
4145
```

0 commit comments

Comments
 (0)