-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Add a JupyterLite-powered interactive shell for the pandas
website (reprise of #47428)
#60758
base: main
Are you sure you want to change the base?
Changes from all commits
c7e2f2a
f8c94e6
2e2da17
c3a8092
c1bd25f
9c9023d
a1d1886
3ce9723
4d56cea
63a075d
b7d27da
0ceedca
9674bfc
c9b3d61
02d7ae3
54470b7
27aac16
59f3e16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,15 @@ dependencies: | |
- requests | ||
- pygments # Code highlighting | ||
|
||
# web interactive REPL | ||
# Pyodide kernel version 0.5.2 comes with Pyodide 0.27.1 | ||
# which in-turn comes with pandas 2.2.3: | ||
# 1. https://jupyterlite-pyodide-kernel.readthedocs.io/en/stable/#compatibility | ||
# 2. https://pyodide.org/en/stable/usage/packages-in-pyodide.html | ||
# We constrain/pin here to avoid breaking changes on rebuilds. | ||
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. We typically do not do this because hard pinning for some time and then doing a major upgrade is often harder than addressing each break as it comes in. Is there a reason we should take a different approach here? |
||
- jupyterlite-core>=0.5.0,<0.6.0 | ||
- jupyterlite-pyodide-kernel=0.5.2 | ||
|
||
- pip: | ||
- adbc-driver-postgresql>=0.10.0 | ||
- adbc-driver-sqlite>=0.8.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# The interactive `pandas` REPL | ||
|
||
An interactive REPL to easily try `pandas` in the browser, powered by JupyterLite. | ||
|
||
![image](https://user-images.githubusercontent.com/591645/175000291-e8c69f6f-5f2c-48d7-817c-cff05ab2cde9.png) | ||
|
||
## Build | ||
|
||
The interactive REPL is built with the `jupyter lite` CLI. | ||
|
||
First make sure `jupyterlite` and a kernel are installed: | ||
|
||
```bash | ||
python -m pip install jupyterlite | ||
python -m pip install jupyterlite-pyodide-kernel | ||
``` | ||
|
||
Then in `web/interactive_terminal`, run the following command: | ||
|
||
```bash | ||
jupyter lite build | ||
``` | ||
|
||
## Configuration | ||
|
||
This folder contains configuration files for the interactive terminal powered by JupyterLite: | ||
|
||
- `jupyter_lite_config.json`: build time configuration, used when building the assets with the `jupyter lite build` command | ||
- `jupyter-lite.json` run time configuration applied when launching the application in the browser | ||
|
||
This interactive `pandas` JupyterLite deployment enables a couple of optimizations to only include the `repl` app in the generated static assets, and disables source maps, which can make the assets smaller and faster to load, at the cost of | ||
debugging capabilities. | ||
|
||
To learn more about it, check out the JupyterLite documentation: | ||
|
||
- Optimizations: https://jupyterlite.readthedocs.io/en/latest/howto/configure/advanced/optimizations.html | ||
- JupyterLite schema: https://jupyterlite.readthedocs.io/en/latest/reference/schema-v0.html | ||
- CLI reference: https://jupyterlite.readthedocs.io/en/latest/reference/cli.html |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"jupyter-lite-schema-version": 0, | ||
"jupyter-config-data": { | ||
"appName": "Pandas REPL", | ||
"appUrl": "./repl", | ||
"enableMemoryStorage": true, | ||
"settingsStorageDrivers": ["memoryStorageDriver"], | ||
"contentsStorageDrivers": ["memoryStorageDriver"] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"LiteBuildConfig": { | ||
"apps": ["repl"], | ||
"no_unused_shared_packages": true, | ||
"output_dir": "../build/lite", | ||
"no_sourcemaps": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,28 @@ by [Wes McKinney](https://wesmckinney.com/), creator of pandas. | |
|
||
## Videos | ||
|
||
<iframe width="560" height="315" frameborder="0" | ||
src="https://www.youtube.com/embed/_T8LGqJtuGc" | ||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" | ||
allowfullscreen></iframe> | ||
<iframe | ||
src="https://www.youtube.com/embed/_T8LGqJtuGc" | ||
style="width: 100%; max-width: 560px; height: 315px;" | ||
frameborder="0" | ||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" | ||
allowfullscreen | ||
></iframe> | ||
|
||
## Cheat sheet | ||
|
||
[pandas cheat sheet](https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf) | ||
|
||
## Try pandas in your browser (experimental) | ||
|
||
You can try pandas in your browser with the following interactive shell | ||
without needing to install anything on your system. | ||
|
||
**Please note it can take a while before the shell is initialised and ready to run commands.** | ||
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. Instead of |
||
|
||
**Running it requires a reasonable amount of bandwidth and resources, so it may not work properly on all devices or networks.** | ||
|
||
<iframe | ||
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. This will start loading on the Getting Started page, is that right? If so, I think we should perhaps move to its own page so that users don't have to spend the bandwidth. |
||
src="./lite/repl/index.html?toolbar=1&kernel=python&execute=0&code=import%20pandas%20as%20pd%0Adf%20%3D%20pd.DataFrame%28%7B%22num_legs%22%3A%20%5B2%2C%204%5D%2C%20%22num_wings%22%3A%20%5B2%2C%200%5D%7D%2C%20index%3D%5B%22falcon%22%2C%20%22dog%22%5D%29%0Adf" | ||
style="width: 100%; max-width: 650px; height: 600px; border: 1px solid #130753;" | ||
></iframe> |
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'm not sure what this comment is attempting to convey - is there a reason this is important? Also, not sure if it's relevant but what comes with pandas 2.2.3 doesn't seem important here; this is used for dev envs, not releases.