-
Notifications
You must be signed in to change notification settings - Fork 21
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
Allow enabling/disabling REPL code execution in the Replite
directive
#245
base: main
Are you sure you want to change the base?
Allow enabling/disabling REPL code execution in the Replite
directive
#245
Conversation
Replite
directive
|
||
if execute == "false": | ||
self.options["execute"] = "0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we raise if execute
is an invalid value ?
And also I'm likely to misunderstand something, (sorry need to restart brain in 2025) but you pop'ed execute
from self.options
inconditionally, but put it back only if false
, should you maybe:
elif execute in ('true', '1'): # i'm assuming 1 is a possible value
self.options['execute'] = '1'
plus, if self.options['execute']
is '0'
originally, you also don't put '0' back in.
And finally, maybe move the new_tab = self.options.pop("new_tab", False)
, below the new code (even lower to like 447 before if new_tab
, or even change to
if self.options.pop("new_tab", False):
to avoid intermediary variables used only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I messed something up here – it would be better that our behaviour is similar to :new_tab:
, such that we keep only True
or False
as acceptable options, and we handle the 1
/0
conversion internally (without lower()
ing anything).
Is this better with 00481a4?
Thanks for the reviews – rebasing and applying the suggested changes in a moment |
Co-authored-by: M Bussonnier <[email protected]>
This reverts commit 1b3b20b.
Description
This pull request exposes functionality added upstream via jupyterlite/jupyterlite#1547 and released in
jupyterlite-core
version0.5.0
.In particular, this enables the act of enabling/disabling the code execution for the
Replite
directive, so it is now possible for the REPL not to load the Pyodide kernel automatically and instead wait for the user's input. It can be controlled via thereplite_auto_execute
option globally or via the:execute: [True/False]
option on a per-directive basis as an override. This appends&execute=0
to the REPL URL ifFalse
.It is to be noted that while we support
jupyterlite-core >=0.2,<0.6
via #238, this option requiresjupyterlite >= 0.5
to work, and there is no effect for versions prior tojupyterlite-core
0.5.Closes #244
Changes made
replite_auto_execute
global configuration option, an:execute:
option for the Replite directive, and corresponding URL handlingAdditional context
This will help us make progress on matplotlib/matplotlib#22634