Skip to content

Enable type-checking for examples#430

Open
thierry-martinez wants to merge 8 commits intoTeamGraphix:masterfrom
thierry-martinez:typing_examples
Open

Enable type-checking for examples#430
thierry-martinez wants to merge 8 commits intoTeamGraphix:masterfrom
thierry-martinez:typing_examples

Conversation

@thierry-martinez
Copy link
Collaborator

This commit adds type annotations in all example modules, and refines the type of PatternSimulator constructor, so that the type parameter for states is automatically inferred from the backend argument.

It enables full type-checking with mypy and pyright while preserving existing functionality across the entire code base. No files are ignored by the typers anymore.

Related issue:
This commit continues the work started in #302, #308, #312, #347, and #414.

This commit adds type annotations in all example modules, and refines
the type of `PatternSimulator` constructor, so that the type parameter
for states is automatically inferred from the `backend` argument.

It enables full type-checking with mypy and pyright while preserving
existing functionality across the entire code base. No files are
ignored by the typers anymore.

**Related issue:**
This commit continues the work started in TeamGraphix#302, TeamGraphix#308, TeamGraphix#312, TeamGraphix#347, and TeamGraphix#414.
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.74%. Comparing base (01ea6cf) to head (612db4e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #430   +/-   ##
=======================================
  Coverage   88.74%   88.74%           
=======================================
  Files          44       44           
  Lines        6308     6308           
=======================================
  Hits         5598     5598           
  Misses        710      710           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@emlynsg emlynsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Do we mind that there are still lots of Pyright warnings?

@thierry-martinez
Copy link
Collaborator Author

thierry-martinez commented Feb 12, 2026

Actually, they were only three warnings:

  • one warning Import "setuptools" could not be resolved from source (reportMissingModuleSource): I believe there is nothing to do about that; we could disable reportMissingModuleSource completely, or make pyright ignore setup.py, but I am not sure what is preferable;
  • two warnings reportInvalidTypeVarUse that can be considered as real issues: I turned them into errors in pyproject.toml and fixed them in 77a2858.

There are 395 informations: we can see if there is something we can do with them at some point, but I consider it is out of the scope of this PR!

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