diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index 908baa87815ab..294334ca1d54b 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -59,6 +59,10 @@ jobs: - name: Build documentation run: doc/make.py --warnings-are-errors + - name: Build the interactive terminal + working-directory: web/interactive_terminal + run: jupyter lite build + - name: Build documentation zip run: doc/make.py zip_html diff --git a/environment.yml b/environment.yml index 69647a436e3ad..a8c8b20e20fe4 100644 --- a/environment.yml +++ b/environment.yml @@ -116,6 +116,13 @@ dependencies: - requests - pygments # Code highlighting + # web interactive REPL + # see the following links for more context: + # 1. https://jupyterlite-pyodide-kernel.readthedocs.io/en/stable/#compatibility + # 2. https://pyodide.org/en/stable/usage/packages-in-pyodide.html + - jupyterlite-core + - jupyterlite-pyodide-kernel + - pip: - adbc-driver-postgresql>=0.10.0 - adbc-driver-sqlite>=0.8.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index fb4d9cdb589ca..990901958cd9e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -85,6 +85,8 @@ feedparser pyyaml requests pygments +jupyterlite-core +jupyterlite-pyodide-kernel adbc-driver-postgresql>=0.10.0 adbc-driver-sqlite>=0.8.0 typing_extensions; python_version<"3.11" diff --git a/web/interactive_terminal/README.md b/web/interactive_terminal/README.md new file mode 100644 index 0000000000000..6457cbccf2016 --- /dev/null +++ b/web/interactive_terminal/README.md @@ -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-core +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 diff --git a/web/interactive_terminal/jupyter-lite.json b/web/interactive_terminal/jupyter-lite.json new file mode 100644 index 0000000000000..2199acf1d368a --- /dev/null +++ b/web/interactive_terminal/jupyter-lite.json @@ -0,0 +1,10 @@ +{ + "jupyter-lite-schema-version": 0, + "jupyter-config-data": { + "appName": "Pandas REPL", + "appUrl": "./repl", + "enableMemoryStorage": true, + "settingsStorageDrivers": ["memoryStorageDriver"], + "contentsStorageDrivers": ["memoryStorageDriver"] + } +} diff --git a/web/interactive_terminal/jupyter_lite_config.json b/web/interactive_terminal/jupyter_lite_config.json new file mode 100644 index 0000000000000..42e64f26f2356 --- /dev/null +++ b/web/interactive_terminal/jupyter_lite_config.json @@ -0,0 +1,8 @@ +{ + "LiteBuildConfig": { + "apps": ["repl"], + "no_unused_shared_packages": true, + "output_dir": "../build/lite", + "no_sourcemaps": true + } +} diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index 801081a9ef391..c556eda57ac31 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -22,11 +22,23 @@ by [Wes McKinney](https://wesmckinney.com/), creator of pandas. ## Videos - + ## 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. + +

+ Try it in your browser +

diff --git a/web/pandas/index.html b/web/pandas/index.html index e8aab9e11144c..4df4d73fb64ec 100644 --- a/web/pandas/index.html +++ b/web/pandas/index.html @@ -18,9 +18,9 @@

pandas

Getting started
diff --git a/web/pandas/try.md b/web/pandas/try.md new file mode 100644 index 0000000000000..ee2f98b05aa64 --- /dev/null +++ b/web/pandas/try.md @@ -0,0 +1,12 @@ +# Try pandas in your browser (experimental) + +Try our experimental [JupyterLite](https://jupyterlite.readthedocs.io/en/stable/) live shell with `pandas`, powered by [Pyodide](https://pyodide.org/en/stable/). + +**Please note it can take a while (>30 seconds) before the shell is initialized and ready to run commands.** + +**Running it requires a reasonable amount of bandwidth and resources (>70 MiB on the first load), so it may not work properly on all devices or networks.** + +