Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

The mypy configuration specified Python 3.9, but the codebase uses Python 3.10+ pattern matching syntax (match/case), causing type checking failures.

Changes

  • mypy.ini: Updated python_version from 3.9 to 3.10 to match CI workflow requirements and added missing import stubs for external libraries (cbor2, numpy, simple_parsing, pn5180_tagomatic, record, common)

  • GitHub Actions workflow: Updated .github/workflows/mypy.yml to exclude open_print_tag/ files from type checking, matching the Makefile's typecheck target pattern. Only *.py and lib/*.py files are now checked.

  • Type annotation fixes in lib/ files:

    • Fixed type annotations in lib/openprinttag_parser.py and lib/spoolman_client.py
    • Added explicit Any type annotations for dynamic data from tag parsing
    • Added Dict[str, Any] annotation to fix incompatible types
    • Added # type: ignore[import-not-found] for imports from external OpenPrintTag code

The external OpenPrintTag files under open_print_tag/ are now excluded from mypy checking as they are third-party code copied from the Prusa OpenPrintTag project.

Example fix pattern:

# Before
data = {"name": name}
if empty_spool_weight:
    data["empty_spool_weight"] = empty_spool_weight

# After  
data: Dict[str, Any] = {"name": name}
if empty_spool_weight:
    data["empty_spool_weight"] = empty_spool_weight

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Support OpenPrintTag tags Fix mypy errors by updating to Python 3.10 and correcting type annotations Jan 13, 2026
Copilot AI requested a review from bofh69 January 13, 2026 19:37
@bofh69 bofh69 force-pushed the support-openprinttag branch from 3530688 to 651fd7a Compare January 13, 2026 19:47
@bofh69
Copy link
Owner

bofh69 commented Jan 13, 2026

@copilot change the workflow to not check the files under open_print_tag with mypy, just like the makefile target "typecheck" already do. Don't update any of the files under open_print_tag. rebase this branch on the updated "support-openprinttag" branch.

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot change the workflow to not check the files under open_print_tag with mypy, just like the makefile target "typecheck" already do. Don't update any of the files under open_print_tag. rebase thi...

Updated in commit 9a65a6b:

  • Reverted all changes to open_print_tag/ files
  • Updated .github/workflows/mypy.yml to exclude open_print_tag files (matching the Makefile typecheck target pattern)
  • Mypy now only checks .py and lib/.py files

Note: The "support-openprinttag" branch is not available in the repository yet. Once it's pushed, I can rebase this branch onto it.

Copilot AI changed the title Fix mypy errors by updating to Python 3.10 and correcting type annotations Fix mypy errors by updating to Python 3.10 and excluding open_print_tag files Jan 13, 2026
@bofh69 bofh69 marked this pull request as ready for review January 13, 2026 20:00
@bofh69 bofh69 closed this Jan 13, 2026
@bofh69 bofh69 deleted the copilot/sub-pr-62 branch January 13, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants