From 0ef26b8708d14654c96e1a50124264f1f24af4c3 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 20 Jun 2022 13:34:11 +0200 Subject: [PATCH 01/21] Add an interactive shell powered by JupyterLite --- web/pandas/getting_started.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index d4f40a1153fb4..abca4ff3f1b87 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -1,5 +1,16 @@ # Getting started +## Try it online + +You can try `pandas` online with the following interactive shell +without installing anything on your computer: + + + ## Installation instructions The next steps provides the easiest and recommended way to set up your From 4809746a0c5f8947349440142e51a4bbdc07f992 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 20 Jun 2022 14:43:19 +0200 Subject: [PATCH 02/21] Update to the dedicated JupyterLite deployment --- web/pandas/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index abca4ff3f1b87..f7f65d2242116 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -6,7 +6,7 @@ You can try `pandas` online with the following interactive shell without installing anything on your computer: From 789d16f95c7e9838d2e8aa9b519a6f9f1e75a969 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 20 Jun 2022 16:29:40 +0200 Subject: [PATCH 03/21] Add example code --- web/pandas/getting_started.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index f7f65d2242116..b64a33489cf83 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -3,7 +3,20 @@ ## Try it online You can try `pandas` online with the following interactive shell -without installing anything on your computer: +without installing anything on your computer. + +For example you can use the following code snippet to interact with the `iris` +dataset: + +```python +import pandas as pd + +# load the dataset +df = pd.read_csv('iris.csv') + +# display the DataFrame +df +``` From 6039fb4e6fb0be0b5814d59b0196212fe7257066 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 10:30:11 +0200 Subject: [PATCH 07/21] Update example code --- web/pandas/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index cce0f182a9da4..7684929fd49a9 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -19,7 +19,7 @@ df ``` From 2241dac9f089169d0168dc2eee4ddfbb78b6041f Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 10:30:40 +0200 Subject: [PATCH 08/21] Update wording --- web/pandas/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index 7684929fd49a9..340cc393aa3bc 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -1,8 +1,8 @@ # Getting started -## Try it online +## Try it in your browser -You can try `pandas` online with the following interactive shell +You can try `pandas` in your browser with the following interactive shell without installing anything on your computer. For example you can use the following code snippet to interact with the `iris` From a2059e9faea655f71e85a0a7393928605e12d2b6 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 10:42:42 +0200 Subject: [PATCH 09/21] Fix trailing spaces --- web/pandas/interactive_terminal/jupyter-lite.json | 2 +- web/pandas/interactive_terminal/jupyter_lite_config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/pandas/interactive_terminal/jupyter-lite.json b/web/pandas/interactive_terminal/jupyter-lite.json index a8d8025716491..61127348a2846 100644 --- a/web/pandas/interactive_terminal/jupyter-lite.json +++ b/web/pandas/interactive_terminal/jupyter-lite.json @@ -11,4 +11,4 @@ "contentsStorageDrivers": ["memoryStorageDriver"] } } - + diff --git a/web/pandas/interactive_terminal/jupyter_lite_config.json b/web/pandas/interactive_terminal/jupyter_lite_config.json index 5c10a6f87b870..a48fc496a6785 100644 --- a/web/pandas/interactive_terminal/jupyter_lite_config.json +++ b/web/pandas/interactive_terminal/jupyter_lite_config.json @@ -4,4 +4,4 @@ "no_unused_shared_packages": true } } - \ No newline at end of file + From e99558862fb2de27ab61d6d427ba227c8249fb3d Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 11:30:41 +0200 Subject: [PATCH 10/21] Move build dependencies to the top-level environment.yml --- .github/workflows/docbuild-and-upload.yml | 4 ---- environment.yml | 5 +++++ web/pandas/requirements.txt | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 web/pandas/requirements.txt diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index fc17d768645d4..fd892eaec1711 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -40,10 +40,6 @@ jobs: - name: Build Pandas uses: ./.github/actions/build_pandas - - name: Install build dependencies - run: | - python -m pip install -r web/pandas/requirements.txt - - name: Build website run: python web/pandas_web.py web/pandas --target-path=web/build diff --git a/environment.yml b/environment.yml index 98631d8485736..fdeda876db7bb 100644 --- a/environment.yml +++ b/environment.yml @@ -123,3 +123,8 @@ dependencies: - feedparser - pyyaml - requests + + # build the interactive terminal + - jupyterlab >=3.4,<4 + - pip: + - jupyterlite==0.1.0b9 \ No newline at end of file diff --git a/web/pandas/requirements.txt b/web/pandas/requirements.txt deleted file mode 100644 index 6b94e0881ac80..0000000000000 --- a/web/pandas/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -jupyterlab~=3.4.3 -jupyterlite==0.1.0b9 From 60e01ec9657423a147547b64d8cec98eecb071bf Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 11:37:07 +0200 Subject: [PATCH 11/21] Move to `web/interactive_terminal` --- .github/workflows/docbuild-and-upload.yml | 4 ++-- web/interactive_terminal/README.md | 13 +++++++++++++ .../interactive_terminal/content/iris.csv | 0 .../interactive_terminal/jupyter-lite.json | 0 .../jupyter_lite_config.json | 0 web/pandas/interactive_terminal/README.md | 17 ----------------- web/pandas_web.py | 17 ----------------- 7 files changed, 15 insertions(+), 36 deletions(-) create mode 100644 web/interactive_terminal/README.md rename web/{pandas => }/interactive_terminal/content/iris.csv (100%) rename web/{pandas => }/interactive_terminal/jupyter-lite.json (100%) rename web/{pandas => }/interactive_terminal/jupyter_lite_config.json (100%) delete mode 100644 web/pandas/interactive_terminal/README.md diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index fd892eaec1711..f60f0fa139ef4 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -46,8 +46,8 @@ jobs: - name: Build documentation run: doc/make.py --warnings-are-errors - - name: Check the interactive terminal assets have been generated - run: stat web/build/lite/build/ + - name: Build the interactive terminal + run: jupyter lite build --lite-dir web/interactive_terminal --output-dir web/build/lite - name: Install ssh key run: | diff --git a/web/interactive_terminal/README.md b/web/interactive_terminal/README.md new file mode 100644 index 0000000000000..79bddce6be798 --- /dev/null +++ b/web/interactive_terminal/README.md @@ -0,0 +1,13 @@ +# The interactive `pandas` terminal + +An interactive terminal to easily try `pandas` in the browser, powered by JupyterLite. + +## Build + +The interactive terminal is built with the `jupyterlite` CLI. + +In `web/interactive_terminal`, run: + +```bash +jupyter lite build --lite-dir web/interactive_terminal --output-dir web/build/lite +``` diff --git a/web/pandas/interactive_terminal/content/iris.csv b/web/interactive_terminal/content/iris.csv similarity index 100% rename from web/pandas/interactive_terminal/content/iris.csv rename to web/interactive_terminal/content/iris.csv diff --git a/web/pandas/interactive_terminal/jupyter-lite.json b/web/interactive_terminal/jupyter-lite.json similarity index 100% rename from web/pandas/interactive_terminal/jupyter-lite.json rename to web/interactive_terminal/jupyter-lite.json diff --git a/web/pandas/interactive_terminal/jupyter_lite_config.json b/web/interactive_terminal/jupyter_lite_config.json similarity index 100% rename from web/pandas/interactive_terminal/jupyter_lite_config.json rename to web/interactive_terminal/jupyter_lite_config.json diff --git a/web/pandas/interactive_terminal/README.md b/web/pandas/interactive_terminal/README.md deleted file mode 100644 index ce4a8a74f606b..0000000000000 --- a/web/pandas/interactive_terminal/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# The interactive `pandas` terminal - -An interactive terminal to easily try `pandas` in the browser, powered by JupyterLite. - -## Build - -Building the terminal is integrated in the main `pandas_web.py` build script. - -In `web/pandas`, run: - -```bash -# install the dependencies -python -m pip install -r requirements.txt - -# build the website -python pandas_web.py -``` diff --git a/web/pandas_web.py b/web/pandas_web.py index bfab50e15f7af..0845a9854f287 100755 --- a/web/pandas_web.py +++ b/web/pandas_web.py @@ -259,21 +259,6 @@ def extend_base_template(content: str, base_template: str) -> str: return result -def build_interactive_terminal(source_path: str, target_path: str) -> int: - build_cmd = [ - "jupyter", - "lite", - "build", - "--lite-dir", - os.path.join(source_path, "interactive_terminal"), - "--output-dir", - os.path.join(target_path, "lite"), - "--debug", - ] - rc = subprocess.run(build_cmd, check=True) - return rc - - def main( source_path: str, target_path: str, base_url: str, ignore_io_errors: bool ) -> int: @@ -321,8 +306,6 @@ def main( os.path.join(source_path, fname), os.path.join(target_path, dirname) ) - build_interactive_terminal(source_path, target_path) - if __name__ == "__main__": parser = argparse.ArgumentParser(description="Documentation builder.") From f51a015fe48381e87b69302a523eca2dd736f343 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 22 Jun 2022 11:37:19 +0200 Subject: [PATCH 12/21] Remove example code --- web/pandas/getting_started.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/web/pandas/getting_started.md b/web/pandas/getting_started.md index 340cc393aa3bc..1e597fdca9e77 100644 --- a/web/pandas/getting_started.md +++ b/web/pandas/getting_started.md @@ -5,19 +5,6 @@ You can try `pandas` in your browser with the following interactive shell without installing anything on your computer. -For example you can use the following code snippet to interact with the `iris` -dataset: - -```python -import pandas as pd - -# load the dataset -df = pd.read_csv('iris.csv') - -# display the DataFrame -df -``` -