From 808774a53010b8fe1b5f371b7a5b99b554d9e3b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 17:21:32 +0000 Subject: [PATCH 1/3] Initial plan From 34259b3ecfe1381ca55cb47a76ef0e9c610fccef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 17:27:04 +0000 Subject: [PATCH 2/3] Add mypy to pre-commit hooks and configure in pyproject.toml Co-authored-by: Borda <6035284+Borda@users.noreply.github.com> --- .pre-commit-config.yaml | 6 ++++++ README.md | 2 +- pyproject.toml | 7 +++++++ test/test_hello.py | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd63a7d..6c56850 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -55,3 +55,9 @@ repos: rev: v2.4.1 hooks: - id: codespell + - repo: https://github.com/pre-commit/mirrors-mypy + # Static type checker + rev: v1.14.1 + hooks: + - id: mypy + additional_dependencies: [] diff --git a/README.md b/README.md index f35fefb..ac7f125 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ You can run the checks manually on all files: pre-commit run --all-files ``` -So far, **there is no types checking with mypy**. See [issue](https://github.com/roboflow-ai/template-python/issues/4). +We now use **mypy** for type checking. Type hints are enforced and checked automatically via pre-commit hooks. ### Tests 🧪 diff --git a/pyproject.toml b/pyproject.toml index d22c330..d0f15c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ urls."Homepage" = "https://roboflow.com" [dependency-groups] dev = [ + "mypy", "pre-commit", "pytest", "twine", @@ -67,3 +68,9 @@ addopts = [ "--color=yes", "--doctest-modules", ] + +[tool.mypy] +python_version = "3.9" +warn_return_any = true +warn_unused_configs = true +disallow_untyped_defs = true diff --git a/test/test_hello.py b/test/test_hello.py index 39aab3d..55533af 100644 --- a/test/test_hello.py +++ b/test/test_hello.py @@ -3,7 +3,7 @@ from sandbox.hello import hello -def test_hello(): +def test_hello() -> None: """Test the hello function.""" res = hello() assert res == "World" From 2a5ffd2ca1eb7a6cf66419edc50b2b3628dca34d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 17:28:06 +0000 Subject: [PATCH 3/3] Remove mypy from dev dependencies and clean up pre-commit config Co-authored-by: Borda <6035284+Borda@users.noreply.github.com> --- .pre-commit-config.yaml | 1 - pyproject.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c56850..467074b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,4 +60,3 @@ repos: rev: v1.14.1 hooks: - id: mypy - additional_dependencies: [] diff --git a/pyproject.toml b/pyproject.toml index d0f15c9..a698831 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ urls."Homepage" = "https://roboflow.com" [dependency-groups] dev = [ - "mypy", "pre-commit", "pytest", "twine",