-
Notifications
You must be signed in to change notification settings - Fork 27
Add more REPL customisation features for JupyterLite 0.6.0 (DO NOT MERGE) #290
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
Open
agriyakhetarpal
wants to merge
10
commits into
jupyterlite:main
Choose a base branch
from
agriyakhetarpal:feat/new-repl-customisations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e9e5edf
Add more REPL configuration options
agriyakhetarpal d61e0fb
Bump to jupyterlite 0.6.0a9
agriyakhetarpal 0dde042
Add extra customisations to options_spec
agriyakhetarpal 6385f7b
Some black formatting fixes
agriyakhetarpal aefcdfb
Handle Replite directive customisations logic
agriyakhetarpal 8d440eb
Handle Replite tab customisations logic
agriyakhetarpal 6ca0e90
Add docs on global REPL configuration
agriyakhetarpal 21c7df5
Add docs on enhanced Replite configuration
agriyakhetarpal d9dc2c9
Install JupyterLite alpha in RTD deployment
agriyakhetarpal e491d48
Temporarily relax jupyterlite-xeus as well
agriyakhetarpal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -157,3 +157,173 @@ global value using an additional `:new_tab_button_text:` parameter: | |||||
``` | ||||||
|
||||||
```` | ||||||
|
||||||
````{tip} | ||||||
|
||||||
## Additional REPL interface options (JupyterLite 0.6.0+) | ||||||
|
||||||
With `jupyterlite-core` versions 0.6.0 and later, the REPL interface comes with several additional customisation options that provide more control over the execution environment and layout: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### Clearing cells on execute | ||||||
|
||||||
To automatically clear the previously executed cells when a new cell is executed, use the `:clear_cells_on_execute:` option: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:clear_cells_on_execute: True | ||||||
|
||||||
# When you execute this cell and then enter new code, | ||||||
# this cell will disappear from the display | ||||||
print("Hello, world!") | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:clear_cells_on_execute: True | ||||||
|
||||||
# When you execute this cell and then enter new code, | ||||||
# this cell will disappear from the display | ||||||
print("Hello, world!") | ||||||
``` | ||||||
|
||||||
### Clearing code content on execute | ||||||
|
||||||
To automatically clear the code content in the prompt cell after execution, use the `:clear_code_on_execute:` option: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:clear_code_content_on_execute: True | ||||||
|
||||||
# After executing this cell, its content will be cleared, | ||||||
# but the output will remain visible | ||||||
print("The code will disappear but this output stays") | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:clear_code_content_on_execute: True | ||||||
|
||||||
# After executing this cell, its content will be cleared, | ||||||
# but the output will remain visible | ||||||
print("The code will disappear but this output stays") | ||||||
``` | ||||||
|
||||||
### Hiding code input | ||||||
|
||||||
To hide the input cells after execution, showing only the output, use the `:hide_code_input:` option: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:hide_code_input: True | ||||||
|
||||||
# After executing this cell, the input will be hidden, | ||||||
# but the output will remain visible | ||||||
print("You'll see this output but not the code that generated it") | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:hide_code_input: True | ||||||
|
||||||
# After execution, this code will be hidden | ||||||
# Only the output will be visible | ||||||
print("You'll see this output but not the code that generated it") | ||||||
``` | ||||||
|
||||||
### Changing prompt cell position | ||||||
|
||||||
By default, the prompt cell is positioned at the bottom of the REPL interface. You can change this using the `:prompt_cell_position:` option, which accepts `top`, `bottom`, `left`, or `right`: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:prompt_cell_position: top | ||||||
|
||||||
# The prompt will appear at the top of the REPL | ||||||
print("Input above, output below") | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:prompt_cell_position: top | ||||||
|
||||||
# The prompt will appear at the top of the REPL | ||||||
print("Input above, output below") | ||||||
``` | ||||||
|
||||||
### Showing or hiding the kernel banner | ||||||
|
||||||
By default, the REPL shows the kernel banner with version information. To hide this banner, use the `:show_banner:` option: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:show_banner: False | ||||||
|
||||||
# The kernel banner won't be displayed | ||||||
print("No banner here") | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:show_banner: False | ||||||
|
||||||
# The kernel banner won't be displayed | ||||||
print("No banner here") | ||||||
``` | ||||||
|
||||||
### Combining options | ||||||
All of these options can be combined to create a customised REPL experience, | ||||||
for example: | ||||||
|
||||||
```rst | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:prompt_cell_position: left | ||||||
:hide_code_input: True | ||||||
:show_banner: False | ||||||
:height: 400px | ||||||
|
||||||
# This will create a clean output-only display | ||||||
# with the input cell on the left | ||||||
import matplotlib.pyplot as plt | ||||||
import numpy as np | ||||||
|
||||||
x = np.linspace(0, 2 * np.pi, 200) | ||||||
y = np.sin(x) | ||||||
|
||||||
fig, ax = plt.subplots() | ||||||
ax.plot(x, y) | ||||||
plt.show() | ||||||
``` | ||||||
|
||||||
```{eval-rst} | ||||||
.. replite:: | ||||||
:kernel: xeus-python | ||||||
:prompt_cell_position: left | ||||||
:hide_code_input: True | ||||||
:show_banner: False | ||||||
:height: 400px | ||||||
|
||||||
# This will create a clean output-only display | ||||||
# with the input cell on the left | ||||||
import matplotlib.pyplot as plt | ||||||
import numpy as np | ||||||
|
||||||
x = np.linspace(0, 2 * np.pi, 200) | ||||||
y = np.sin(x) | ||||||
|
||||||
fig, ax = plt.subplots() | ||||||
ax.plot(x, y) | ||||||
plt.show() | ||||||
``` | ||||||
|
||||||
```` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We can likely add
jupyterlite-xeus
back here (on the latest version), as it should now work fine with JupyterLite 0.6 (it is being used in https://github.com/jupyter/try-jupyter for instance)