Repository navigation
Revive Table.show_in_notebook method but with ipydatagrid - #17165
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.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
2a67a04 to
5fd7245
Compare
|
|
||
| @pytest.mark.skipif(not HAS_IPYTHON, reason="requires iPython") | ||
| @pytest.mark.skipif(not HAS_IPYDATAGRID, reason="requires ipydatagrid") | ||
| # https://github.com/bqplot/bqplot/issues/1624 and such |
There was a problem hiding this comment.
|
They way this is implemented right now is a backwards-incompatible change to |
|
Re: show_as_datagrid The pro is we are free of API debt. The con is people might not discover it, though I guess we can add that as the alternative in the deprecation warning. Let's see what @taldcroft thinks. Thanks! |
|
A compromise to avoid any actual errors due to API change would be to deprecate the original keyword arguments unless they are also used for ipydatagrid. We could even translate them into ipydatagrid arguments if possible. But I don't think we should use a different method name. |
|
Hmm. I'd rather not have the burden of us keeping track of ipydatagrid changes, especially since they don't seem to have proper API documentation. |
|
I agree with @astrofrog that we should not introduce a new method name, this just causes more API bloat. Instead, how about introducing a This is an API change in that the default backend is |
|
The |
What kind of mechanism do you have in mind? |
|
Re: #17165 (comment) @taldcroft , but then how do we document all the different combos of |
|
Also multiple backends are going to bloat up our "optional" dependencies. |
|
About documentation, maybe put the backend functions into About optional dependency bloat, that's always a thorny question. I don't have a great answer except to say that we shouldn't let slippery-slope arguments derail our progress here. For this particular PR we are just adding one new optional dependency, which is OK. Questions about the slippery-slope can be considered out of scope. About a mechanism for user defined backends, I thought about it as well. At this point I'm not sure why the user needs to use the |
|
I don't think there's any real need to support user-defined backends in v7.0, but they would be nice to have in the future. When we do want to enable user-defined backends then having a separate |
Yup. This could be a registration function, a global dict of available backend functions, and a module-level |
|
So... you all want to get rid of notebook support altogether a few months ago. But now want to support all whole slew of backends? That is quite a turn. |
What we didn't want was maintaining fiddly javascript code that was coupled to external tools like Jupyter. But we listened to users who said that they really do want rich notebook table display and then realized that plugging in a 3rd party tool would satisfy both needs. The evolution to backends is not strictly necessary but seems to neatly allow a bit of back-compatibility (for the deprecated astropy version) while making a new version (ipydatagrid) be the default. Sometimes life and code is a rollercoaster ride, no? 😄 |
5fd7245 to
f4cabb7
Compare
|
Okay, I think I implemented requested changes. Please re-review. Thanks! |
998d353 to
9df83e3
Compare
There was a problem hiding this comment.
Note: I followed the layout from modeling.
|
Thanks @pllim! Just a bunch of word-smithing. |
|
I think this should also get a Whats New. |
|
One more thing is that the |
415eb3b to
dea1980
Compare
|
@taldcroft , I think I implemented all your feedback except #17165 (comment)
Is the "See Also" section not enough? What else do you have in mind? |
|
@pllim - I think the |
dea1980 to
0c8e447
Compare
|
Please re-review. Thanks! 🙏 |
taldcroft
left a comment
There was a problem hiding this comment.
Looking great. I did some functional testing and it works as expected. Just a few more suggestions, mostly on docs.
| .. note:: | ||
| This function requires an optional dependency, ``ipydatagrid``. | ||
|
|
||
| Parameters |
There was a problem hiding this comment.
Add something like:
This function creates an ``ipydatagrid.DataGrid`` object by converting the input
``table`` to a ``pandas.DataFrame`` and passing ``**kwargs`` to the constructor.
The available ``DataGrid`` options can be seen in a Jupyter notebook with
``help(ipydatagrid.DataGrid)``.
| **kwargs : dict, optional | ||
| Keyword arguments accepted by ``ipydatagrid.DataGrid``. | ||
|
|
||
| """ |
There was a problem hiding this comment.
I didn't because the "classic" backend docstring never had one. Also, when used in practice, the returned object is used directly by the notebook, so it is not something that should concern the user?
There was a problem hiding this comment.
The show_in_notebook() function in both cases returns an object that supports rich display in Jupyter notebook (for effectively repr(obj)). There is nothing stopping the user from doing:
dg = table.show_in_notebook()
# ... manipulate `dg` somehow with public methods and attributes
dg
The historical fact that the return type was not documented is IMO a bug in the original.
but with ipydatagrid. Co-authored-by: Tom Aldcroft <[email protected]>
as taldcroft and eerovaher suggested Expose notebook_backends for API doc
and other minor doc edits. [ci skip] Co-authored-by: Tom Aldcroft <[email protected]>
but the suggestions are incomplete [ci skip] Co-authored-by: Tom Aldcroft <[email protected]>
and code clean-up including fixing test for classic, making ipydatagrid check come first because it is new default and stop referring to self (astropy) as a third person in docstring.
Co-authored-by: Tom Aldcroft <[email protected]>
[ci skip] Co-authored-by: Tom Aldcroft <[email protected]>
[ci skip] Co-authored-by: Tom Aldcroft <[email protected]>
23f6e11 to
1601476
Compare
|
Thanks for catching all the details, @taldcroft . I think I have addressed them all now. Please rerereview. |
Description
This pull request is to address demand to bring back
show_in_notebookby un-deprecating it but now use ipydatagrid as suggested in #16702 (comment) .Fixes #16702
Reverts #15905 a little
Rendered doc: https://astropy--17165.org.readthedocs.build/en/17165/table/index.html