From ad81c01f4a94a2590b0e641b2067af285025d010 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Fri, 4 Oct 2024 09:28:49 -0700 Subject: [PATCH 1/4] do not install shiny if installing another way --- .github/py-shiny/setup/action.yaml | 9 ++++++++- .github/workflows/deploy-tests.yaml | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/py-shiny/setup/action.yaml b/.github/py-shiny/setup/action.yaml index dfa398f9f..a289d4dba 100644 --- a/.github/py-shiny/setup/action.yaml +++ b/.github/py-shiny/setup/action.yaml @@ -5,6 +5,10 @@ inputs: description: 'Python version to use' required: false default: "3.12" + install: + description: 'Should shiny be installed' + required: false + default: "true" runs: using: "composite" steps: @@ -30,22 +34,25 @@ runs: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV - name: Install dependencies + if: ${{ inputs.install == 'true' }} shell: bash run: | make ci-install-deps - name: Install + if: ${{ inputs.install == 'true' }} shell: bash run: | make ci-install-wheel - name: Install backports.tarfile - if: ${{ startsWith(inputs.python-version, '3.8') }} + if: ${{ startsWith(inputs.python-version, '3.8') && inputs.install == 'true' }} shell: bash run: | uv pip install backports.tarfile - name: Pip list + if: ${{ inputs.install == 'true' }} shell: bash run: | uv pip list diff --git a/.github/workflows/deploy-tests.yaml b/.github/workflows/deploy-tests.yaml index 24fdfa358..30ef32556 100644 --- a/.github/workflows/deploy-tests.yaml +++ b/.github/workflows/deploy-tests.yaml @@ -77,17 +77,16 @@ jobs: uses: ./.github/py-shiny/setup with: python-version: ${{ matrix.python-version }} + install: ${{ !(matrix.config.pypi_shiny || matrix.config.github_shiny) }} - name: Install pypi shiny and htmltools (uninstall GitHub versions) if: ${{ matrix.config.pypi_shiny }} run: | - uv pip uninstall shiny htmltools uv pip install shiny htmltools - name: Install GitHub shiny@v1.0.0 and htmltools@v0.5.3 (uninstall PyPI versions) if: ${{ matrix.config.github_shiny }} run: | - uv pip uninstall shiny htmltools uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git@v0.5.3" "shiny @ git+https://github.com/posit-dev/py-shiny.git@v1.0.0" - name: Install rsconnect (PyPI) From 25f3cba0f090bc1e26e1bb7871013bac9dc44fb6 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Fri, 4 Oct 2024 09:39:58 -0700 Subject: [PATCH 2/4] Revert "do not install shiny if installing another way" This reverts commit ad81c01f4a94a2590b0e641b2067af285025d010. --- .github/py-shiny/setup/action.yaml | 9 +-------- .github/workflows/deploy-tests.yaml | 3 ++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/py-shiny/setup/action.yaml b/.github/py-shiny/setup/action.yaml index a289d4dba..dfa398f9f 100644 --- a/.github/py-shiny/setup/action.yaml +++ b/.github/py-shiny/setup/action.yaml @@ -5,10 +5,6 @@ inputs: description: 'Python version to use' required: false default: "3.12" - install: - description: 'Should shiny be installed' - required: false - default: "true" runs: using: "composite" steps: @@ -34,25 +30,22 @@ runs: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV - name: Install dependencies - if: ${{ inputs.install == 'true' }} shell: bash run: | make ci-install-deps - name: Install - if: ${{ inputs.install == 'true' }} shell: bash run: | make ci-install-wheel - name: Install backports.tarfile - if: ${{ startsWith(inputs.python-version, '3.8') && inputs.install == 'true' }} + if: ${{ startsWith(inputs.python-version, '3.8') }} shell: bash run: | uv pip install backports.tarfile - name: Pip list - if: ${{ inputs.install == 'true' }} shell: bash run: | uv pip list diff --git a/.github/workflows/deploy-tests.yaml b/.github/workflows/deploy-tests.yaml index 30ef32556..24fdfa358 100644 --- a/.github/workflows/deploy-tests.yaml +++ b/.github/workflows/deploy-tests.yaml @@ -77,16 +77,17 @@ jobs: uses: ./.github/py-shiny/setup with: python-version: ${{ matrix.python-version }} - install: ${{ !(matrix.config.pypi_shiny || matrix.config.github_shiny) }} - name: Install pypi shiny and htmltools (uninstall GitHub versions) if: ${{ matrix.config.pypi_shiny }} run: | + uv pip uninstall shiny htmltools uv pip install shiny htmltools - name: Install GitHub shiny@v1.0.0 and htmltools@v0.5.3 (uninstall PyPI versions) if: ${{ matrix.config.github_shiny }} run: | + uv pip uninstall shiny htmltools uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git@v0.5.3" "shiny @ git+https://github.com/posit-dev/py-shiny.git@v1.0.0" - name: Install rsconnect (PyPI) From 027a498cf7e05537eb623ee5135e27aa5f932ef1 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Fri, 4 Oct 2024 09:42:03 -0700 Subject: [PATCH 3/4] use dynamic import to get around testing bug --- shiny/render/_data_frame_utils/_html.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shiny/render/_data_frame_utils/_html.py b/shiny/render/_data_frame_utils/_html.py index d88307e33..58849577e 100644 --- a/shiny/render/_data_frame_utils/_html.py +++ b/shiny/render/_data_frame_utils/_html.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Literal, cast, overload -from htmltools import TagNode, is_tag_node +from htmltools import TagNode from ..._typing_extensions import TypeIs from ...types import Jsonifiable @@ -70,6 +70,7 @@ def ui_must_be_processed( def ui_must_be_processed( # pyright: ignore[reportInconsistentOverload] val: object, ): + from htmltools import is_tag_node if isinstance(val, str): return False From c5d4e44712b0abc168acd5a1cb49529ed16c6876 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Fri, 4 Oct 2024 09:45:43 -0700 Subject: [PATCH 4/4] linting issues --- shiny/render/_data_frame_utils/_html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/shiny/render/_data_frame_utils/_html.py b/shiny/render/_data_frame_utils/_html.py index 58849577e..1465827bc 100644 --- a/shiny/render/_data_frame_utils/_html.py +++ b/shiny/render/_data_frame_utils/_html.py @@ -71,6 +71,7 @@ def ui_must_be_processed( # pyright: ignore[reportInconsistentOverload] val: object, ): from htmltools import is_tag_node + if isinstance(val, str): return False