Add "tox -e static" for static type checking (Pyright)
Metadata
Current evaluation
Added a tox environment for Pyright static type checking. Merged after approval and passing CI checks. Updated ops version pinning to >=2.4.1 and adjusted code for type checker compatibility.
Suggested action: —
No scores available.
Issue body
This is part of my work in https://github.com/canonical/operator/issues/920. Notes:
* Type checkers like the `self.on["container"].pebble_ready` syntax over the magic `self.on.container_pebble_ready` shorthand, so go with that.
* Unfortunately we need a "type: ignore" on the ops.main() call as main() is a special module+function due to canonical/operator#910.
* The "simple" charm will only work with ops>=2.4.1 due to canonical/operator#962. Will ship 2.4.1 imminently.
* I've changed the ops version pinning to 2.x (but 2.4 or higher).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Added a tox environment for Pyright static type checking. Merged after approval and passing CI checks. Updated ops version pinning to >=2.4.1 and adjusted code for type checker compatibility. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged benhoyt's update adding a tox environment for Pyright static type checking. The change updates event handler syntax to bracket notation, adds a type ignore for ops.main(), and pins the ops dependency to version 2.4.1 or higher. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged changes adding a tox environment for Pyright static type checking. Updates adjust attribute syntax for type checkers, add a type ignore for ops.main(), and pin the ops dependency to 2.x or higher. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2405 feat: merge the 'static' tox environment into the 'lint' one | charmcraft | merged | Merged the static tox environment into the lint environment to integrate pyright type checking into the lint command for machine and kubernetes init profiles. Approved by four reviewers. | |
| #34 static: update excluded and changes from new errors | craft-store | merged | Merged after approval and passing CI. Updates static analysis exclusions, adds py.typed, fixes README packaging, corrects float retry handling, ignores urllib3 typing, and excludes .tox from linters. |