mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
757 stars 56 forks source link

New function "init_notebook_mode" #19

Closed mwouts closed 3 years ago

mwouts commented 3 years ago

This PR introduces a new function "init_notebook_mode" that

This will hopefully solve #6 and #17.

Give it a try on Binder: https://mybinder.org/v2/gh/mwouts/itables/version_0.3.0?filepath=README.md. Now when we reload the notebook, the outputs disappear (because that is a text only notebook), but when the cells are re-executed the tables appear again (still, the cell with the init_notebook_mode needs to be executed first, otherwise the other cells won't work).

You can also try it locally with

pip install git+https://github.com/mwouts/itables.git@version_0.3.0
codecov-io commented 3 years ago

Codecov Report

Merging #19 (c41f7d5) into master (87a5614) will increase coverage by 0.12%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
+ Coverage   96.77%   96.90%   +0.12%     
==========================================
  Files          10       10              
  Lines         217      226       +9     
==========================================
+ Hits          210      219       +9     
  Misses          7        7              
Impacted Files Coverage Δ
itables/__init__.py 100.00% <100.00%> (ø)
itables/interactive.py 100.00% <100.00%> (ø)
itables/javascript.py 93.47% <100.00%> (+0.79%) :arrow_up:
itables/version.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 87a5614...c41f7d5. Read the comment docs.

mwouts commented 3 years ago

Hi @neon-ninja , @GZR5876 , @jpbarrette, I have prepared this PR which seems to solve #6 and #17.

But it changes how the fully interactive mode is initialized.

Now instead of doing

import itables.interactive

the user will have to do:

from itables import init_notebook_mode
init_notebook_mode(all_interactive=True)

Are you OK with this? And with the name of the function / the arguments?

Note that import itables.interactive will still work, but will issue a deprecation warning asking the user to use the new form.

I'll be glad to have your feedback. You can test it either locally or on binder (instructions & links in the previous comment).