Repository navigation
API: deprecate show_in_notebook - #15905
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
I'll defer to subpackage maintainers and Jupyter experts here. The test fails because you need to handle this new warning. Also would need a change log. Thanks! |
| return HTML(html) | ||
|
|
||
| @deprecated_renamed_argument("jsviewer", None, "6.1", pending=True) | ||
| def show_in_browser( |
There was a problem hiding this comment.
show_in_browser is not related to Jupyter, and is not broken. It creates a standalone HTML file and was the original reason of using datatables etc., the notebook integration came later.
Not sure if it's widely used though.
There was a problem hiding this comment.
There was a problem hiding this comment.
I agree show_in_browser is not Jupyter-related. What about splitting this into two PRs? I think deprecating show_in_notebook is the right call, and that we shouldn't replace it. The underpinnings of notebook change too often for us to support well in astropy.
I'm less clear about show_in_browser.
On the one hand, it works. On the other hand, it adds dependencies that we are bundling in jsviewer.py that are not update regularly by dependabot. If we are going to supply show_in_browser then it seems worth discussing separately from show_in_notebook.
At the end of the day, I lean towards deprecating show_in_browser too and seeing what the reaction from the community is...
There was a problem hiding this comment.
I find show_in_browser to be very useful fwiw, although I don't really use the jsviewer flag that often.
mwcraig
left a comment
There was a problem hiding this comment.
See my inline comments. To summarize, I'd recommend changing this notebook to deprecate show_in_notebook and a separate PR to handle show_in_browser.
|
As a developer, I agree to deprecating both (but I also support @mwcraig 's suggestion of discussing that in two separate PRs, since one case is more clear than the other). As a user, I always forget that We already have a If we can make the same work for panel is less commonly used than pandas, but their Tabulator widgets displays a table sortable per column, which is often useful. Edit: Add link to |
|
Similarly, one might also use a bokeh My point is that instead of offloading the task of displaying the html table to a js library that we bundle, we could do that indirectly and offload to some other python package from the scientific ecosystem where js support is closer to their core mission and have them worry about which version to bundle and howto handle notebook updates etc. I think of this a mostly a documentation task: "If you want to display your |
|
Thanks all for your reviews! Yes I think it probably makes sense to link to other well maintained libraries for working with Tables interactively inside a jupyter environment. I have removed the deprecation of |
|
👍 in general on deprecating these methods. I never found them all that useful in practice and the interactive browser is a bit clunky. |
I just had a look at the pandas styling and I don't think that would be useful for the most-common use case of someone that was previously using The pandas machinery does not (AFAIK) provide a way to interactively browse a table. It just clips the table in the same way that astropy does. (Maybe I'm missing something?). So I would be against recommending a workflow that uses pandas styling. For the 98% use case here (setting precision of floats), astropy table formatting does the job and is way more convenient (IMHO). |
mwcraig
left a comment
There was a problem hiding this comment.
In the short run we can just open an issue to note that it would be nice to recommend a replacement rather than hashing that out here.
pllim
left a comment
There was a problem hiding this comment.
Thanks, but I have a question and a comment.
|
There are good reasons to deprecate the functions in question, but I would like there to be documentation about available alternatives, and if we do write such documentation then the deprecation message should point to it. |
I'm not aware of any easy alternatives to |
|
tl;dr -- I see one approval, so is the diff okay as-is or more discussion needed? If so, what? |
|
ipydatagrid is what I would have recommended -- I think that with the alternatives listed now this is good to go. May want to wait for @taldcroft though? |
Co-authored-by: P. L. Lim <[email protected]>
|
@taldcroft just wanted to bump this up. |
Co-authored-by: Eero Vaher <[email protected]>
|
One more thing that we have failed to notice so far is that Lines 112 to 113 in 5579997 If we are deprecating the function then we shouldn't be advertising it in our documentation anymore. |
|
Just in case, you could do a recursive grep on the whole repo checkout too, to smoke out the rest. |
eerovaher
left a comment
There was a problem hiding this comment.
This should now be good enough to squash and merge, but I'm not a table maintainer.
|
And thanks to other reviewers for the inputs. |
|
@MridulS - I've approved this, but can you track down the "show-in-notebook" issues that this fixes and put them in the description before we merge so they all get auto-closed? |
|
@taldcroft thanks! updated #15905 (comment) with the relevant issues. |
|
So, is this good to merge now? 😸 |
YES! |
|
So happy to see one PR closes multiple issues. Thanks, all! |
|
Looks like not everyone is happy with this, please see #16702 and advise. Thanks! |
* API: deprecate show_in_notebook and JSViewer * do not deprecate jsviewer, add test * remove pending deprecation * Add links to alternatives * add API doc * Update docs/changes/table/15905.api.rst Co-authored-by: P. L. Lim <[email protected]> * Update astropy/table/table.py Co-authored-by: Eero Vaher <[email protected]> * remove show_in_notebook for table docs --------- Co-authored-by: P. L. Lim <[email protected]> Co-authored-by: Eero Vaher <[email protected]>
|
I run into this today as prepping notebooks for an upcoming AAS workshop. I see why it is removed, but otoh none of the offered alternatives are as nice our of the box experience, I mean I don't want to pull in all of bokeh just to have nicely formatted tables in a notebook. (we didn't use the |
We should have a FAQ, but for the record (and for your tutorial), Table provides these capabilities that are not in pandas DataFrame:
|
|
As far as I can tell (from quick googling), pandas does not provide an interactive scrollable notebook interface for exploring notebooks. Google just shows 3rd party solutions. This choice by pandas would seem to support the astropy decision to delegate this kind of functionality to 3rd party packages.
This sort of comment comes up regularly, and I respect your perspective but honestly do not understand it. I just installed bokeh and it required 6.9 Mb and completed in under a second, so I would just do it without a second thought and then use it. |
|
There is this interesting news: https://blog.jupyter.org/ipydatagrid-is-now-part-of-project-jupyter-3b3dfb877664 I haven't looked into it carefully, but maybe we can leverage ipydatagrid and provide interactive Table display using this as the optional (?) dependency. BTW standalone ipydatagrid install is a little lighter at 3.1 Mb. |
|
Thanks, all! Let's continue discussions of follow-up topics here: |
|
If you forget interactivity (I don't necessarily need that, for more complex interactivity tasks we use firefly anyway), but if there was an easy opt in config list that would make Table printing look pretty in a notebook by default, I would be super happy with it. (I am thinking for my users who work in notebooks, and I really can't see it being a nice workflow to have them work with tables and any time they need to print more than a handful or rows I suggest them to pop into a third-party library instead. ) And my issue with adding bokeh just for this is not about size, but past experience of their changing API (it may very well be more stable now), and the technical debt I would introduce to this material just by introducing a new dependency with the sole purpose of pretty printing tables. |
Description
Let's take a bit agressive way to fix #15566, this PR proposes to deprecate
show_in_notebook()and all notebook (classic) specific JS code. The Jupyter Notebook has moved to using the JupyterLab plumbing (from v7) and the classic notebook is on maintainence mode. Things will probably move fast in the JupyterLab world and the JS specific code in astropy will only work with classic notebook. I would argue that astropy shouldn't be in the business of JS specific logic, this should either be delagated to other third party tools like https://github.com/bloomberg/ipydatagrid, https://github.com/mwouts/itables or the jupyter specific code be moved to a new package something likeastropy-jupyter-extension. This should make the maintenance much more sustainable.There is some conversation on Slack regarding this: https://astropy.slack.com/archives/C067V74GK/p1705405195253679
Well this "fixes" a lot of
show_in_notebookissues 😅cc @hamogu @pllim @mwcraig @dhomeier
fix #11836, fix #9660 (partially, as this feature could still be added to show_in_browser), fix #15566, fix #10317