Skip to content

Disable code execution on page load for the NumPy REPL #824

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

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

agriyakhetarpal
Copy link
Contributor

Brief description of what is fixed or changed

This pull request disables the code execution for the import numpy as np command, which should reduce bandwidth usage as NumPy would then not be downloaded from the Pyodide CDN as a result until the user decides to press the Enteror return buttons (or any other buttons to inject code into the REPL).

This useful option comes from jupyterlite/jupyterlite#1547, which was released in https://github.com/jupyterlite/jupyterlite/releases/tag/v0.5.0, and was updated to in jupyterlite/demo#150, i.e., with the JupyterLite deployment that we use.


cc: @rgommers

Copy link

netlify bot commented Jan 21, 2025

Deploy Preview for numpy-org ready!

Name Link
🔨 Latest commit 0466655
🔍 Latest deploy log https://app.netlify.com/sites/numpy-org/deploys/679927f90bf0f90008049e93
😎 Deploy Preview https://deploy-preview-824--numpy-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@agriyakhetarpal
Copy link
Contributor Author

The failures from the link checker are unrelated.

Here are two screenshots of the REPL for a comparison:

Before
NumPy JupyterLite REPL in white on the numpy.org website. The REPL has an 'import numpy as np' command in a code prompt that has been executed when the page loaded. NumPy has been imported automatically with the loading of the website.
After
NumPy JupyterLite REPL in white on the numpy.org website. The REPL has an 'import numpy as np' command in a code prompt with a grey background that has not been executed yet, and is waiting on input from the user..

It would be possible to customise the position of the code prompt cell (top/bottom/etc.) when jupyterlab/jupyterlab#13837 makes it to a release and when JupyterLite updates to that version of JupyterLab (hopefully soon!).

@agriyakhetarpal agriyakhetarpal changed the title Disable code execution for the NumPy REPL Disable code execution on page load for the NumPy REPL Jan 21, 2025
Copy link
Contributor

@stefanv stefanv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @agriyakhetarpal; that's a good way to save some resources.

@stefanv
Copy link
Contributor

stefanv commented Jan 21, 2025

See #825 for a CI fix.

@stefanv stefanv merged commit 3bfce2f into numpy:main Jan 28, 2025
4 checks passed
@stefanv
Copy link
Contributor

stefanv commented Jan 28, 2025

Thank you @agriyakhetarpal!

@agriyakhetarpal agriyakhetarpal deleted the fix/disable-repl-code-execution branch January 28, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants