Typing updates for strict mode - #97
Conversation
samaloney
commented
Jul 9, 2026
- Updates code and configs for strict mode and add pyright configuration
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
==========================================
- Coverage 92.39% 89.63% -2.77%
==========================================
Files 14 8 -6
Lines 1591 955 -636
==========================================
- Hits 1470 856 -614
+ Misses 121 99 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates xrayvision to support stricter static type checking (mypy strict mode + pyright strict), primarily by tightening type annotations, adding targeted casts/ignores for untyped decorators, and adjusting a few configuration files to align tooling behavior.
Changes:
- Adds/updates type annotations across core modules (
visibility,imaging,transform,mem,clean, coordinates frames) to satisfy stricter type checkers. - Introduces strict mypy and pyright configuration in
pyproject.tomland updates pre-commit hooks accordingly. - Minor housekeeping updates to packaging/examples/changelog/coverage configuration.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| xrayvision/visibility.py | Adds typing/casts for metadata and visibility accessors; updates ABC signatures. |
| xrayvision/transform.py | Adds typing for NDArray generics and suppresses untyped decorators. |
| xrayvision/mem.py | Adds typing/casts and small refactors for strict checker compatibility. |
| xrayvision/imaging.py | Adds typing, clarifies return variables, tightens scheme type annotations. |
| xrayvision/coordinates/frames.py | Adds casts/ignores to satisfy strict typing around coordinate frames/WCS. |
| xrayvision/clean.py | Adds typing, refines array typing, and makes docstring concatenation safe under strict mode. |
| xrayvision/init.py | Suppresses an attr-defined type-checking warning for __version__. |
| pyproject.toml | Enables mypy strict mode and adds a strict pyright configuration. |
| MANIFEST.in | Minor formatting-only change. |
| examples/stix.py | Makes percent_lambda a Quantity (apu.percent). |
| changelog/97.feature.rst | Adds changelog entry for strict typing updates and configs. |
| .pre-commit-config.yaml | Updates hook versions and mypy hook configuration; adds repo-level exclude. |
| .gitignore | Removes initial header comments. |
| .coveragerc | Expands coverage omit patterns (including tests and _sunpy_init). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| value = self.get(key, None) | ||
| if not isinstance(value, (key_type, type(None))): | ||
| if not isinstance(value, (key_type | type(None))): | ||
| raise KeyError(f"Inputs must include a key, '{key}', that gives a {key_type}.") |
| unit, equivalencies=equivalencies | ||
| ) | ||
| ): | ||
| raise ValueError(f"'{key}' must have angular units.") |
| @@ -1,6 +1,7 @@ | |||
| exclude: ".*(.csv|.fits|.fts|.fit|.header|.txt|tca.*|.json|.asdf)$|^CITATION.rst|tools\/" | |||