Added repr-based responses and corresponding options#84
Conversation
R/options.R
Outdated
There was a problem hiding this comment.
Why wouldn't we try all of them? It could make sense to have e.g. a png representation of something other than a plot.
There was a problem hiding this comment.
ipython also has a knob to dis/enable some of the formats. It's used by the mpl inline backend to set the send back image formats.
There was a problem hiding this comment.
Anyway: the way the system there works, it really tries all of the enabled ones, so even for plots, the repr_markdownwould be tried (and return nothing)
There was a problem hiding this comment.
Sorry, I should have been clearer: I agree with having an option to configure this, but I'd put all the formats we know IPython can display in there by default - I think that just means adding image/png and image/svg+xml to this list.
There was a problem hiding this comment.
do you think i should do the same for jupyter.plot_mimetypes?
how does ipython handle this?
There was a problem hiding this comment.
IPython makes no difference between plotting and displaying anything else, the "knob" to influence the plotting formats is actually just is a convenience function, which (de-)activates the image formatter: https://github.com/ipython/ipython/blob/master/IPython/core/pylabtools.py#L172
|
Whatever comes out of these discussion: I think it would be good to add a blogpost like document to the default Jupyter documentations where this system is explained for "kernel developers", so that other can use that to model their own system after it... I can build one after this text here: IRkernel/IRdisplay#3 (comment) (second part) [Edit: added a issue here. https://github.com/jupyter/jupyter_client/issues/2] |
|
since the discussion is hidden now: the default for results is now everything. do you think i should do the same for i think it only makes sense to list those which actually have a |
|
I think the problem here is that if the plotting option is just "setting an option like "jupyter.plot_mimetypes" to a list", we miss out any validation/"translation" to the normal display formatter like the ipython equivalent does. Or is there a way to validate options when it is set via |
|
we could use the settings package (section “Using the # not exported
MYPKGOPTIONS <- options_manager(a = 1, b = 2)
#' <documentation of options here>
#' @export
pkg_options <- function(...) {
# protect against the use of reserved words.
stop_if_reserved(...)
# validate stuff
opts <- list(...)
if (!is.null(names(opts))) for (opt in names(opts)) switch(opt,
a = stopifnot(condition),
b = stopifnot(condition))
# set or get
MYPKGOPTIONS(...)
} |
c93c39a to
bad1a11
Compare
|
so, any objections to pulling this in? |
|
I think this looks good. |
Added repr-based responses and corresponding options
fixes #59