You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivated by #5499 -- we can add custom display code in the Positron Python kernel on a case by case basis when we find that __repr__ renders badly or some other reason (performance or unwanted computation). But: dealing with display rendering for third party libraries within Positron has a number of drawbacks:
We are responsible for maintaining this code, and handling a new third party library requires making changes to Positron and waiting until a new version is released to get the improvement.
If there is a breaking change to a third party library that causes the display rendering code in Positron to stop working, then the current and all previous versions of Positron will all be broken with the new library version going forward.
Clearly, this is not ideal! IPython / Jupyter in the past had provided a _repr_html_ display hook for third party libraries to provide an HTML rendering for the Jupyter notebook. We could define a similar _repr_positron_ (open to ideas on the name) or similar hook to allow libraries to define how they display in the variables pane. If this method isn't present, we can fall back onto __repr__.
The text was updated successfully, but these errors were encountered:
Just for visibility, we have already invested in extending the Variables pane for R in posit-dev/ark#560 and related PRs. I'm not sure if we learned much that is transferable, however, other than that we needed to do this?
Thanks for cross-linking! Based on what was built there, a collection of different APIs for each class:
Ark currently supports six methods with the following signatures:
ark_variable_display_value(x, ..., width = getOption("width"))
ark_variable_display_type(x, ..., include_length = TRUE)
ark_variable_kind(x, ...)
ark_variable_has_children(x, ...)
ark_variable_get_children(x, ...)
ark_variable_get_child_at(x, ..., index, name)
It would make sense instead of a simplistic _repr_positron_ method, instead to have a duck-typed variables inspection API for third party libraries, where they can provide implementations of all of these methods. I don't think there is urgency, but at some point we can draft and review the abstract API to adopt in the Python kernel.
… is True (#5625)
Addresses #5499 by adding a custom inspector for Ibis expressions. This
is very basic, and per #5573 should perhaps live eventually in Ibis
itself.
Ibis is a bit unusual in that its interactive mode causes computation to
be executed when running the `__repr__` method, for nice interactivity
in the console and in Jupyter notebooks. So here we avoid running the
`__repr__` method so we don't accidentally fire off a BigQuery,
Snowflake, or other query which might have unwanted costs or side
effects.
There is a unit test -- Ibis with DuckDB is a minor dependency to pull
in relative to the rest of our test dependencies so I do not think this
is too onerous.
Motivated by #5499 -- we can add custom display code in the Positron Python kernel on a case by case basis when we find that
__repr__
renders badly or some other reason (performance or unwanted computation). But: dealing with display rendering for third party libraries within Positron has a number of drawbacks:Clearly, this is not ideal! IPython / Jupyter in the past had provided a
_repr_html_
display hook for third party libraries to provide an HTML rendering for the Jupyter notebook. We could define a similar_repr_positron_
(open to ideas on the name) or similar hook to allow libraries to define how they display in the variables pane. If this method isn't present, we can fall back onto__repr__
.The text was updated successfully, but these errors were encountered: