Repository navigation
Conversation
|
Thanks for picking this up, @SHANNWD! I took an early look at the direction (not a full review yet), and it looks right to me: it follows the plan from #6549, and the changes stay close to what mypy asks for. Some thoughts before you invest more time:
|
|
Thanks for the early feedback, @falkoschindler! I've updated the PR with all three items:
|
|
Thanks for the quick update, @SHANNWD! mypy and pre-commit are green now, and the annotations make the tests a lot more compact. The remaining red check is not a flake: both CI runs fail on If you are at it: some |
|
@falkoschindler Thanks for the review! I updated \ est_streamed_media_file_handle_is_released_on_teardown\ to also \del response, and split the chained = None\ variables in \ est_element.py, \ est_element_delete.py, and \ est_scene_view.py\ into separate type annotations. Both \pytest\ on the serving-files teardown test and \mypy --platform linux\ + |
Motivation
Fixes #6549.
CI previously ran
mypyon./niceguiand./_nicegui_worker.pyonly, leavingtests/unchecked (383 errors across 60 test files on Python 3.11 / Linux). Enablingmypyacrosstests/catches typing regressions in tests and test helpers automatically in CI.Implementation
tests/):assert <var> is not Noneguards fornonlocalpage elements andscreen_plugin.DOWNLOAD_DIR.# type: ignorecomments with specific mypy error codes (and removed an unused# type: ignoreintests/test_user_simulation.py).WebElementtruthiness assertions tois not None, annotated empty containers (Event[Any],list[Exception],list[int],WeakSet[ui.label]), guarded nullableget_attribute(...)returns, replaced void-return tuple lambdas with small helper functions, and separated pandas/polarsDataFramevariables intest_table.pyandtest_aggrid.py.nicegui/testing/user.py: Added the missingUser.find(target: str, *, kind: type[T], ...)@overloadso calls likeuser.find('A', kind=ui.radio)type-check cleanly..github/workflows/_check.yml,CONTRIBUTING.md, andAGENTS.mdto runmypy ./nicegui ./_nicegui_worker.py tests.Verification
uv run mypy --platform linux ./nicegui ./_nicegui_worker.py tests(Python 3.11):Success: no issues found in 419 source filesuv run ruff check tests/ nicegui/testing/user.py:All checks passed!uv run pylint nicegui/testing/user.py:10.00/10uv run pytest(User-plugin tests includingtest_radio_click_with_userandtest_validate_with_return_result_rejects_async_checks): passedProgress
mypy,ruff,pylint,pytest) pass locally.CONTRIBUTING.md,AGENTS.md) and CI workflow (.github/workflows/_check.yml) are updated.