From 79fa01a235531272c0fb04cbe41136f9f87b8c8b Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 21 Jul 2025 15:27:56 -0700 Subject: [PATCH 1/2] Fix webapp for Shinylive deployment by separating requirements Shinylive/Pyodide was failing because it tried to install packages that are already pre-built in Pyodide (like matplotlib and its C-extension dependencies). Changes: - Split requirements into two files: - requirements.txt: Minimal deps for Shinylive (only astral, shiny, shinyswatch) - requirements-dev.txt: Full deps for local development (includes matplotlib) - Update README to use requirements-dev.txt for local development - Update GitHub workflow to use requirements-dev.txt - Remove matplotlib version pinning as Pyodide provides it This fixes the "Can't find a pure Python 3 wheel for 'contourpy'" error when loading the webapp at https://basnijholt.github.io/adaptive-lighting/ --- .github/workflows/deploy-webapp.yml | 2 +- webapp/README.md | 2 +- webapp/requirements-dev.txt | 103 ++++++++++++++++++++++++++ webapp/requirements.txt | 109 ++-------------------------- webapp/requirements.txt.in | 3 +- 5 files changed, 111 insertions(+), 108 deletions(-) create mode 100644 webapp/requirements-dev.txt diff --git a/.github/workflows/deploy-webapp.yml b/.github/workflows/deploy-webapp.yml index e52963b0..bdb95781 100644 --- a/.github/workflows/deploy-webapp.yml +++ b/.github/workflows/deploy-webapp.yml @@ -39,7 +39,7 @@ jobs: - name: Install Dependencies run: | - pip install -r webapp/requirements.txt + pip install -r webapp/requirements-dev.txt pip install shinylive - name: Build the WebAssembly app diff --git a/webapp/README.md b/webapp/README.md index b12432eb..e561b8f4 100644 --- a/webapp/README.md +++ b/webapp/README.md @@ -2,7 +2,7 @@ To run this app locally, install the requirements and run `shiny run`. ``` $ cd webapp -$ pip install -r requirements.txt +$ pip install -r requirements-dev.txt $ shiny run ``` diff --git a/webapp/requirements-dev.txt b/webapp/requirements-dev.txt new file mode 100644 index 00000000..e39c5bcb --- /dev/null +++ b/webapp/requirements-dev.txt @@ -0,0 +1,103 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile requirements.txt.in --output-file requirements-dev.txt +anyio==4.9.0 + # via + # starlette + # watchfiles +appdirs==1.4.4 + # via shiny +asgiref==3.9.1 + # via shiny +astral==2.2 + # via -r requirements.txt.in +click==8.2.1 + # via + # shiny + # uvicorn +contourpy==1.3.1 + # via matplotlib +cycler==0.12.1 + # via matplotlib +fonttools==4.58.5 + # via matplotlib +h11==0.16.0 + # via uvicorn +htmltools==0.6.0 + # via + # shiny + # shinyswatch +idna==3.10 + # via anyio +kiwisolver==1.4.8 + # via matplotlib +linkify-it-py==2.0.3 + # via shiny +markdown-it-py==3.0.0 + # via + # mdit-py-plugins + # shiny +matplotlib==3.8.4 + # via -r requirements.txt.in +mdit-py-plugins==0.4.2 + # via shiny +mdurl==0.1.2 + # via markdown-it-py +narwhals==1.46.0 + # via shiny +numpy==2.3.1 + # via + # contourpy + # matplotlib +orjson==3.10.18 + # via shiny +packaging==25.0 + # via + # htmltools + # matplotlib + # shiny + # shinyswatch +pillow==11.3.0 + # via matplotlib +prompt-toolkit==3.0.51 + # via + # questionary + # shiny +pyparsing==3.2.3 + # via matplotlib +python-dateutil==2.9.0.post0 + # via matplotlib +python-multipart==0.0.20 + # via shiny +pytz==2023.3.post1 + # via astral +questionary==2.1.0 + # via shiny +setuptools==80.9.0 + # via shiny +shiny==1.4.0 + # via + # -r requirements.txt.in + # shinyswatch +shinyswatch==0.9.0 + # via -r requirements.txt.in +six==1.17.0 + # via python-dateutil +sniffio==1.3.1 + # via anyio +starlette==0.47.1 + # via shiny +typing-extensions==4.14.1 + # via + # htmltools + # shiny + # shinyswatch +uc-micro-py==1.0.3 + # via linkify-it-py +uvicorn==0.35.0 + # via shiny +watchfiles==1.1.0 + # via shiny +wcwidth==0.2.13 + # via prompt-toolkit +websockets==15.0.1 + # via shiny diff --git a/webapp/requirements.txt b/webapp/requirements.txt index c09a3d7a..1079f508 100644 --- a/webapp/requirements.txt +++ b/webapp/requirements.txt @@ -1,105 +1,6 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile requirements.txt.in --output-file requirements.txt -anyio==4.9.0 - # via - # starlette - # watchfiles -appdirs==1.4.4 - # via shiny -asgiref==3.9.1 - # via shiny +# Minimal requirements for Shinylive deployment +# Only packages not pre-installed in Pyodide +# matplotlib and dependencies are already in Pyodide astral==2.2 - # via -r requirements.txt.in -click==8.2.1 - # via - # shiny - # uvicorn -contourpy==1.3.1 - # via - # -r requirements.txt.in - # matplotlib -cycler==0.12.1 - # via matplotlib -fonttools==4.58.5 - # via matplotlib -h11==0.16.0 - # via uvicorn -htmltools==0.6.0 - # via - # shiny - # shinyswatch -idna==3.10 - # via anyio -kiwisolver==1.4.8 - # via matplotlib -linkify-it-py==2.0.3 - # via shiny -markdown-it-py==3.0.0 - # via - # mdit-py-plugins - # shiny -matplotlib==3.8.4 - # via -r requirements.txt.in -mdit-py-plugins==0.4.2 - # via shiny -mdurl==0.1.2 - # via markdown-it-py -narwhals==1.46.0 - # via shiny -numpy==2.3.1 - # via - # contourpy - # matplotlib -orjson==3.10.18 - # via shiny -packaging==25.0 - # via - # htmltools - # matplotlib - # shiny - # shinyswatch -pillow==11.3.0 - # via matplotlib -prompt-toolkit==3.0.51 - # via - # questionary - # shiny -pyparsing==3.2.3 - # via matplotlib -python-dateutil==2.9.0.post0 - # via matplotlib -python-multipart==0.0.20 - # via shiny -pytz==2023.3.post1 - # via astral -questionary==2.1.0 - # via shiny -setuptools==80.9.0 - # via shiny -shiny==1.4.0 - # via - # -r requirements.txt.in - # shinyswatch -shinyswatch==0.9.0 - # via -r requirements.txt.in -six==1.17.0 - # via python-dateutil -sniffio==1.3.1 - # via anyio -starlette==0.47.1 - # via shiny -typing-extensions==4.14.1 - # via - # htmltools - # shiny - # shinyswatch -uc-micro-py==1.0.3 - # via linkify-it-py -uvicorn==0.35.0 - # via shiny -watchfiles==1.1.0 - # via shiny -wcwidth==0.2.13 - # via prompt-toolkit -websockets==15.0.1 - # via shiny +shiny +shinyswatch \ No newline at end of file diff --git a/webapp/requirements.txt.in b/webapp/requirements.txt.in index 986a4976..9703163f 100644 --- a/webapp/requirements.txt.in +++ b/webapp/requirements.txt.in @@ -1,5 +1,4 @@ astral==2.2 -matplotlib==3.8.4 -contourpy==1.3.1 +matplotlib shinyswatch shiny From 022f3b42c5e8dd349b6a0da827091790163a4101 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:33:21 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- webapp/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/requirements.txt b/webapp/requirements.txt index 1079f508..91d94a98 100644 --- a/webapp/requirements.txt +++ b/webapp/requirements.txt @@ -3,4 +3,4 @@ # matplotlib and dependencies are already in Pyodide astral==2.2 shiny -shinyswatch \ No newline at end of file +shinyswatch