Skip to content

Commit f643a8f

Browse files
authored
bug: Verify mypy can run on CI (posit-dev#1650)
1 parent 6ba4cdd commit f643a8f

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.github/workflows/pytest.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ jobs:
5858
run: |
5959
make check-format
6060
61+
- name: Verify code can run with mypy (not Windows)
62+
if: steps.install.outcome == 'success' && (success() || failure()) && matrix.os != 'windows-latest'
63+
run: |
64+
make ci-check-mypy-can-run
65+
6166
pypi:
6267
name: "Deploy to PyPI"
6368
runs-on: ubuntu-latest

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ ci-install-rsconnect: FORCE
225225
uv pip install "rsconnect-python @ git+https://github.com/rstudio/rsconnect-python.git"
226226

227227

228+
# This is just to check if mypy can run for other users.
229+
# Not added to `make check` or `make check-fix` as all lint errors are supporessed (as we use pyright).
230+
ci-check-mypy-can-run: FORCE
231+
@echo "-------- Checking types with mypy -----------"
232+
uv pip install mypy
233+
mypy shiny
234+
235+
228236
# ## If caching is ever used, we could run:
229237
# install-deps: FORCE ## install latest dependencies
230238
# pip install --editable ".[dev,test]" --upgrade --upgrade-strategy eager

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,10 @@ ignore = ["E302", "E501", "F403", "F405", "W503", "E203", "E701", "E704"]
144144
[tool.isort]
145145
profile = "black"
146146
skip = ["__init__.py", "typings/", "_dev/", ".venv", "venv", ".tox", "build"]
147+
148+
[tool.mypy]
149+
# The goal of our usage of mypy is to make to sure mypy can run, not that it catches any errors (we use pyright to find our errors).
150+
# Therefore, ignore_errors but do not ignore runtime errors while checking
151+
# Note: This setting can not be done via CLI and must be set within a config
152+
ignore_errors = true
153+
exclude = ["shiny/api-examples", "shiny/templates"]

shiny/render/_data_frame_utils/_selection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def _has_rect(self) -> bool:
150150
# Should only contain a single selection area
151151

152152
# Do not include `BrowserCellSelectionAll` as it should be represented by a row, column, or region with appropriate values.
153-
# class BrowserCellSelectionAll(TypedDict):
154-
# type: Literal["all"]
153+
# # class BrowserCellSelectionAll(TypedDict):
154+
# # type: Literal["all"]
155155

156156

157157
class BrowserCellSelectionNone(TypedDict):

0 commit comments

Comments
 (0)