Skip to content

Typing updates for strict mode - #96

Closed
samaloney wants to merge 4 commits into
mainfrom
typing-update
Closed

Typing updates for strict mode#96
samaloney wants to merge 4 commits into
mainfrom
typing-update

Conversation

@samaloney

Copy link
Copy Markdown
Member

Strict typing and add pyright configuration

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.14815% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.62%. Comparing base (446f563) to head (94b19b1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
xrayvision/coordinates/frames.py 80.00% 1 Missing ⚠️
xrayvision/mem.py 95.45% 1 Missing ⚠️
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.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread xrayvision/visibility.py
) -> None:
value = self.get(key, None)
if not isinstance(value, (key_type, type(None))):
if not isinstance(value, (key_type | type(None))):
Comment thread xrayvision/visibility.py
unit, equivalencies=equivalencies
)
):
raise ValueError(f"'{key}' must have angular units.")
Comment thread pyproject.toml
exclude = "(^|/)tests/"

[tool.pyright]
pythonVersion = "3.11"
Comment thread .pre-commit-config.yaml
@@ -1,6 +1,7 @@
exclude: ".*(.csv|.fits|.fts|.fit|.header|.txt|tca.*|.json|.asdf)$|^CITATION.rst|tools\/"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Comment thread xrayvision/visibility.py
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 thread xrayvision/visibility.py
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.")
Comment thread pyproject.toml
exclude = "(^|/)tests/"

[tool.pyright]
pythonVersion = "3.11"
@samaloney samaloney closed this Jul 9, 2026
@samaloney
samaloney deleted the typing-update branch July 9, 2026 21:58
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