-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a Jupyter Widget for ITables #319
Conversation
Thank you for making this pull request. Did you know? You can try it on Binder: . Also, the version of ITables developed in this PR can be installed with
(this requires |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #319 +/- ##
==========================================
- Coverage 95.88% 93.65% -2.24%
==========================================
Files 27 28 +1
Lines 1191 1339 +148
==========================================
+ Hits 1142 1254 +112
- Misses 49 85 +36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4f0f7c8
to
d22ac3c
Compare
just tried to run through the docs (on binder and locally) and got this error: import ipywidgets as widgets
from itables import show
from itables.sample_dfs import get_dict_of_test_dfs
sample_dfs = get_dict_of_test_dfs()
def use_show_in_interactive_output(table_name: str):
show(
sample_dfs[table_name],
caption=table_name,
style="table-layout:auto;width:auto;float:left;caption-side:bottom",
)
table_selector = widgets.Dropdown(options=sample_dfs.keys(), value="int_float_str")
out = widgets.interactive_output(
use_show_in_interactive_output, {"table_name": table_selector}
)
widgets.VBox([table_selector, out]) full stack trace
|
Thanks for giving it a go, and sorry about that - My attempt to simplify the This should be fixed now, at least I have seen this notebook run on Binder: https://mybinder.org/v2/gh/mwouts/itables/try_anywidget?urlpath=lab/tree/docs/ipywidgets.md. Let me know what you think! Thanks |
thanks @mwouts for the fix - just had a quick play and have a few comments to address as you see fit:
you can copy the markdown below into you ## JG Comments
```{code-cell} ipython3
import ipywidgets as widgets
from itables import show
from itables.sample_dfs import get_dict_of_test_dfs
from itables.widget import ITable
sample_dfs = get_dict_of_test_dfs()
name = "ordered_categories"
df = sample_dfs[name]
table = ITable()
table = ITable(
df,
caption=name,
select=True,
style="table-layout:auto;width:auto;float:left",
)
table
|
Hi @jgunstone , thank you so much for your feedback, that's really helpful!
Well interesting that you mention that! I was seeing Internally the itables/packages/itables_anywidget/js/widget.ts Lines 94 to 96 in d8c25a0
At the very least I should make that more explicit in the documentation. I can also move the traits that I don't think people should use to underscore names as you suggest, that's a good point! Actually, the traits that I would like to expose are the following:
At some point I plan to make the tables editable (#243, will require a subscription to datatables' editor), but until then I don't want to expose Also thanks for pointing out at |
Hi hi - and then the just playing with what vars would typically be passed to import pandas as pd
import itables.options as opt
from itables import init_notebook_mode, show
from itables.sample_dfs import get_countries
df = get_countries(html=False)
init_notebook_mode(all_interactive=True)
show(df, classes="display nowrap compact") ITable(df, classes="display nowrap compact")
# ^ this works the same as show which is nice from a user perspective.
ITable(df, dt_args=dict(classes="display nowrap compact"))
# ^ this doesn't do anything.... |
7558042
to
3bd7c6d
Compare
60e1f24
to
2f7ee96
Compare
Selected rows in the widget, in Streamlit and in Shiny (#250) Version 2.2.0
The Jupyter Widget is now part of ITables v2.2. See https://mwouts.github.io/itables/ipywidgets.html for the documentation. Thank you @jgunstone for your feedback on the widget, it has been very helpful. Since our last chat I have made sure that only the traits that the user can modify directly are public. I have also added a Re your last question re |
I have used AnyWidget to provide the widget, as suggested at #267 (comment)
Closes #267
Closes #250
TODO
update
is called withselected_rows=None
(the default)