Skip to content

Typing updates for strict mode - #97

Merged
samaloney merged 10 commits into
TCDSolar:mainfrom
samaloney:typing-update
Jul 15, 2026
Merged

Typing updates for strict mode #97
samaloney merged 10 commits into
TCDSolar:mainfrom
samaloney:typing-update

Conversation

@samaloney

Copy link
Copy Markdown
Member
  • Updates code and configs for strict mode and add pyright configuration

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.29730% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.63%. Comparing base (17a2716) to head (444fd11).

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

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 Outdated
unit, equivalencies=equivalencies
)
):
raise ValueError(f"'{key}' must have angular units.")
Comment thread .pre-commit-config.yaml Outdated
@@ -1,6 +1,7 @@
exclude: ".*(.csv|.fits|.fts|.fit|.header|.txt|tca.*|.json|.asdf)$|^CITATION.rst|tools\/"
@samaloney
samaloney merged commit 4eaaa91 into TCDSolar:main Jul 15, 2026
24 of 25 checks passed
@samaloney
samaloney deleted the typing-update branch July 15, 2026 15:41
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