diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5c5ed374d..f1125cc8e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -209,6 +209,9 @@ jobs: - name: Run mypy working-directory: api/python/slint run: uv run mypy -p tests -p slint + - name: Run mypy on slint-compiler + working-directory: api/python/compiler + run: uv run mypy slint_compiler - name: Run ruff linter working-directory: api/python/slint run: uv tool run ruff check diff --git a/api/python/compiler/pyproject.toml b/api/python/compiler/pyproject.toml index 473c1eb34..34b86d49c 100644 --- a/api/python/compiler/pyproject.toml +++ b/api/python/compiler/pyproject.toml @@ -19,3 +19,14 @@ Tracker = "https://github.com/slint-ui/slint/issues" [project.scripts] slint-compiler = "slint_compiler:main" + +[dependency-groups] +dev = ["mypy>=1.15.0"] + +[tool.mypy] +strict = true +disallow_subclassing_any = false + +[[tool.mypy.overrides]] +module = ["cached_path.*"] +follow_untyped_imports = true diff --git a/api/python/compiler/slint_compiler/__init__.py b/api/python/compiler/slint_compiler/__init__.py index 217c82cb8..23ed38ff3 100644 --- a/api/python/compiler/slint_compiler/__init__.py +++ b/api/python/compiler/slint_compiler/__init__.py @@ -10,7 +10,7 @@ import os from importlib.metadata import version, PackageNotFoundError -def main(): +def main() -> None: try: package_version = version("slint-compiler") # Strip alpha/beta from for example "1.13.0b1" @@ -58,7 +58,7 @@ def main(): local_path = cached_path.cached_path( url_and_path_within_archive, extract_archive=True ) - args = [local_path] + args = [str(local_path)] args.extend(sys.argv[1:]) subprocess.run(args)