Typing updates for strict mode - #96
Closed
samaloney wants to merge 4 commits into
Closed
Conversation
* mypy strict mode config * pyright config
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
==========================================
- Coverage 92.39% 89.62% -2.78%
==========================================
Files 14 8 -6
Lines 1591 954 -637
==========================================
- Hits 1470 855 -615
+ Misses 121 99 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens typing across the xrayvision package to support strict type checking, and adds/updates static-analysis configuration (notably pyright) alongside related tooling adjustments.
Changes:
- Add/adjust type annotations (including casts and decorator ignores) across core imaging/visibility/clean/MEM code.
- Introduce strict pyright configuration and tighten mypy settings in
pyproject.toml. - Update developer tooling/config files (pre-commit, coverage omit rules, minor manifest/gitignore tweaks).
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| xrayvision/visibility.py | Adds richer typing for metadata and visibility accessors; introduces casts/typing adjustments. |
| xrayvision/transform.py | Updates typing for numpy arrays and silences untyped decorator warnings for quantity decorators. |
| xrayvision/mem.py | Adds typing to MEM internals and refines a few variables/returns for strict checking. |
| xrayvision/imaging.py | Adds typing and refines function signatures/return typing for imaging utilities. |
| xrayvision/coordinates/frames.py | Adds typing/casts to WCS↔frame helpers and silences a frame typing issue. |
| xrayvision/clean.py | Adds typing to CLEAN implementations and refines docstring concatenation and internal array typing. |
| xrayvision/init.py | Silences a typing complaint on the exported __version__. |
| pyproject.toml | Enables strict mypy and adds strict pyright configuration. |
| MANIFEST.in | Minor formatting change. |
| .pre-commit-config.yaml | Adds global exclude, updates hook revisions, and adjusts mypy hook behavior. |
| .gitignore | Removes the introductory comment block. |
| .coveragerc | Expands omit patterns for init/tests paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) -> None: | ||
| value = self.get(key, None) | ||
| if not isinstance(value, (key_type, type(None))): | ||
| if not isinstance(value, (key_type | type(None))): |
| unit, equivalencies=equivalencies | ||
| ) | ||
| ): | ||
| raise ValueError(f"'{key}' must have angular units.") |
| exclude = "(^|/)tests/" | ||
|
|
||
| [tool.pyright] | ||
| pythonVersion = "3.11" |
| @@ -1,6 +1,7 @@ | |||
| exclude: ".*(.csv|.fits|.fts|.fit|.header|.txt|tca.*|.json|.asdf)$|^CITATION.rst|tools\/" | |||
Comment on lines
166
to
168
| 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}.") |
Comment on lines
+169
to
176
| if ( | ||
| unit is not None | ||
| and value is not None | ||
| and not cast(Any, value).unit.is_equivalent( # pyright: ignore[reportUnnecessaryCast] | ||
| unit, equivalencies=equivalencies | ||
| ) | ||
| ): | ||
| raise ValueError(f"'{key}' must have angular units.") |
| exclude = "(^|/)tests/" | ||
|
|
||
| [tool.pyright] | ||
| pythonVersion = "3.11" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Strict typing and add pyright configuration