From a75188f2b8eaab36c795b888b3c03f9a91d45c66 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:08:33 +0100 Subject: [PATCH 01/10] adds start file --- .binder/start | 1 + 1 file changed, 1 insertion(+) create mode 100644 .binder/start diff --git a/.binder/start b/.binder/start new file mode 100644 index 0000000..b1fffc6 --- /dev/null +++ b/.binder/start @@ -0,0 +1 @@ +jupyter-lab --notebook-dir=notebooks \ No newline at end of file From c0f302f42c297a9643b54a34c30da520d59e2c14 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:15:26 +0100 Subject: [PATCH 02/10] make executble --- .binder/start | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .binder/start diff --git a/.binder/start b/.binder/start old mode 100644 new mode 100755 From 1cbd094a1f3fd39749c818b550ee426fee5a7044 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:20:58 +0100 Subject: [PATCH 03/10] bashify --- .binder/start | 1 + 1 file changed, 1 insertion(+) diff --git a/.binder/start b/.binder/start index b1fffc6..7940171 100755 --- a/.binder/start +++ b/.binder/start @@ -1 +1,2 @@ +#!/bin/bash jupyter-lab --notebook-dir=notebooks \ No newline at end of file From fb09e8716056d8fa22daa8220e994fe34ffb63b2 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:23:30 +0100 Subject: [PATCH 04/10] labs to notebook --- .binder/start | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.binder/start b/.binder/start index 7940171..0bf3e21 100755 --- a/.binder/start +++ b/.binder/start @@ -1,2 +1,2 @@ #!/bin/bash -jupyter-lab --notebook-dir=notebooks \ No newline at end of file +jupyter-notebook --notebook-dir=notebooks \ No newline at end of file From 9b2d8fa404e39c7c5907f87021b7e3e530310763 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:27:54 +0100 Subject: [PATCH 05/10] debugging step as launch failing silently --- .binder/start | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.binder/start b/.binder/start index 0bf3e21..10d5b3b 100755 --- a/.binder/start +++ b/.binder/start @@ -1,2 +1,10 @@ #!/bin/bash -jupyter-notebook --notebook-dir=notebooks \ No newline at end of file +set -e +set -x + +if [ ! -d "notebooks" ]; then + echo "Error: The 'notebooks' directory does not exist in the working directory." + exit 1 +fi + +jupyter-lab --notebook-dir=notebooks \ No newline at end of file From e5e4a8651d6cba200a9bdad5abe6f820c5ccca53 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 10:31:48 +0100 Subject: [PATCH 06/10] further debugging step --- .binder/start | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.binder/start b/.binder/start index 10d5b3b..f82bb4e 100755 --- a/.binder/start +++ b/.binder/start @@ -1,10 +1,30 @@ #!/bin/bash -set -e -set -x +# Enable debugging and exit on error +set -ex + +# Check if the notebook directory exists if [ ! -d "notebooks" ]; then - echo "Error: The 'notebooks' directory does not exist in the working directory." + echo "Error: The 'notebooks' directory does not exist!" exit 1 fi -jupyter-lab --notebook-dir=notebooks \ No newline at end of file +# Find the full path to the jupyter-lab executable +JUPYTER_LAB_PATH=$(which jupyter-lab) + +# Check if jupyter-lab was found +if [ -z "$JUPYTER_LAB_PATH" ]; then + echo "Error: jupyter-lab executable not found in PATH." + # Fallback to an explicit path + JUPYTER_LAB_PATH="/srv/conda/envs/notebook/bin/jupyter-lab" + if [ ! -f "$JUPYTER_LAB_PATH" ]; then + echo "Error: jupyter-lab not found at explicit path either." + exit 1 + fi +fi + +# Print the command we are about to run +echo "Starting JupyterLab server with command: $JUPYTER_LAB_PATH --notebook-dir=notebooks" + +# Execute the jupyter-lab command +exec "$JUPYTER_LAB_PATH" --notebook-dir=notebooks \ No newline at end of file From ca4adb021416956df1fe6c9e883644190ff9954e Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 19:03:42 +0100 Subject: [PATCH 07/10] experiment book for debugging in root --- .binder/start | 31 ++----------------------------- experiment.ipynb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 experiment.ipynb diff --git a/.binder/start b/.binder/start index f82bb4e..6b989c5 100755 --- a/.binder/start +++ b/.binder/start @@ -1,30 +1,3 @@ #!/bin/bash - -# Enable debugging and exit on error -set -ex - -# Check if the notebook directory exists -if [ ! -d "notebooks" ]; then - echo "Error: The 'notebooks' directory does not exist!" - exit 1 -fi - -# Find the full path to the jupyter-lab executable -JUPYTER_LAB_PATH=$(which jupyter-lab) - -# Check if jupyter-lab was found -if [ -z "$JUPYTER_LAB_PATH" ]; then - echo "Error: jupyter-lab executable not found in PATH." - # Fallback to an explicit path - JUPYTER_LAB_PATH="/srv/conda/envs/notebook/bin/jupyter-lab" - if [ ! -f "$JUPYTER_LAB_PATH" ]; then - echo "Error: jupyter-lab not found at explicit path either." - exit 1 - fi -fi - -# Print the command we are about to run -echo "Starting JupyterLab server with command: $JUPYTER_LAB_PATH --notebook-dir=notebooks" - -# Execute the jupyter-lab command -exec "$JUPYTER_LAB_PATH" --notebook-dir=notebooks \ No newline at end of file +# Start Jupyter in the correct directory +exec jupyter lab --ContentsManager.root_dir=/home/jovyan \ No newline at end of file diff --git a/experiment.ipynb b/experiment.ipynb new file mode 100644 index 0000000..487ec48 --- /dev/null +++ b/experiment.ipynb @@ -0,0 +1,35 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "50f6a64e", + "metadata": {}, + "source": [ + "Let's try this experiment just in case it works..." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b9a496f3", + "metadata": { + "vscode": { + "languageId": "plaintext" + } + }, + "outputs": [], + "source": [ + "i = 1\n", + "j = 1\n", + "print(i+j)" + ] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 3b91831b5c19c265498c60d1363722f7412708a4 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 19:15:01 +0100 Subject: [PATCH 08/10] try with a postbuild file --- .binder/postBuild | 15 +++++++++++++++ .binder/requirements.txt | 7 ++++++- .binder/start | 11 +++++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 .binder/postBuild diff --git a/.binder/postBuild b/.binder/postBuild new file mode 100755 index 0000000..acd468f --- /dev/null +++ b/.binder/postBuild @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail + +echo "[postBuild] Editable install of local package" +pip install -e . + +echo "[postBuild] Warm up matplotlib font cache" +python - <<'PY' +import matplotlib.pyplot as plt # triggers font cache build +print("Matplotlib imported; font cache built.") +PY + +echo "[postBuild] Warm up JupyterLab (pre-build static if needed)" +jupyter lab build --minimize=False >/dev/null 2>&1 || true +echo "[postBuild] Done" \ No newline at end of file diff --git a/.binder/requirements.txt b/.binder/requirements.txt index 2f1c87e..20d3721 100644 --- a/.binder/requirements.txt +++ b/.binder/requirements.txt @@ -1 +1,6 @@ -rcpchgrowth[notebook] \ No newline at end of file +pandas +matplotlib +jupyterlab +ipykernel +scipy +python-dateutil \ No newline at end of file diff --git a/.binder/start b/.binder/start index 6b989c5..0623498 100755 --- a/.binder/start +++ b/.binder/start @@ -1,3 +1,10 @@ #!/bin/bash -# Start Jupyter in the correct directory -exec jupyter lab --ContentsManager.root_dir=/home/jovyan \ No newline at end of file +set -euo pipefail +echo "[start] Python: $(python -V)" +echo "[start] rcpchgrowth import test:" +python - <<'PY' +import rcpchgrowth, os, sys +print("rcpchgrowth version:", getattr(rcpchgrowth, "__version__", "?")) +print("rcpchgrowth path:", rcpchgrowth.__file__) +PY +exec jupyter lab --ServerApp.root_dir=/home/jovyan --ServerApp.default_url=/lab \ No newline at end of file From 973d81517ffbc2e8ed8a710d299a5146aa3efefe Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 19:21:58 +0100 Subject: [PATCH 09/10] remove start --- .binder/start | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 .binder/start diff --git a/.binder/start b/.binder/start deleted file mode 100755 index 0623498..0000000 --- a/.binder/start +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -euo pipefail -echo "[start] Python: $(python -V)" -echo "[start] rcpchgrowth import test:" -python - <<'PY' -import rcpchgrowth, os, sys -print("rcpchgrowth version:", getattr(rcpchgrowth, "__version__", "?")) -print("rcpchgrowth path:", rcpchgrowth.__file__) -PY -exec jupyter lab --ServerApp.root_dir=/home/jovyan --ServerApp.default_url=/lab \ No newline at end of file From 69396169414468292e629a4316a93a710271ef3f Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Aug 2025 19:41:02 +0100 Subject: [PATCH 10/10] removes debugging experiment.ipynb, add binder badge to readme --- README.md | 1 + experiment.ipynb | 35 ----------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 experiment.ipynb diff --git a/README.md b/README.md index b7b5f4b..4bd6e26 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![PyPI version](https://img.shields.io/pypi/v/rcpchgrowth.svg?style=flat-square&labelColor=%2311a7f2&color=%230d0d58)](https://pypi.org/project/rcpchgrowth/) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg?style=flat-square&labelColor=%2311a7f2&color=%230d0d58)](https://www.gnu.org/licenses/agpl-3.0) +[![Binder](https://img.shields.io/badge/Binder-Binder?style=flat-square&labelColor=%2311a7f2&color=%230d0d58&logo=jupyter)](https://mybinder.org/v2/gh/rcpch/rcpchgrowth-python/live?urlpath=lab/tree/notebooks/Quickstart.ipynb) [![Codespaces](https://img.shields.io/badge/Codespaces-Open_in_Cloud?style=flat-square&labelColor=%2311a7f2&color=%230d0d58&logo=github&logoColor=white)](https://codespaces.new/rcpch/rcpchgrowth-python?quickstart=1) Please go to for full documentation. diff --git a/experiment.ipynb b/experiment.ipynb deleted file mode 100644 index 487ec48..0000000 --- a/experiment.ipynb +++ /dev/null @@ -1,35 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "50f6a64e", - "metadata": {}, - "source": [ - "Let's try this experiment just in case it works..." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b9a496f3", - "metadata": { - "vscode": { - "languageId": "plaintext" - } - }, - "outputs": [], - "source": [ - "i = 1\n", - "j = 1\n", - "print(i+j)" - ] - } - ], - "metadata": { - "language_info": { - "name": "python" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}