Repository navigation
Conversation
Describe the 30 public functions of `scalar_inv_efuncs.pyx` so that Mypy can check the code that calls them. The stub was generated from the Cython signatures (`double` -> `float`, `int` -> `int`, `list` -> `list[float]`) and checked with `stubtest` against the compiled module (apart from the Cython-generated `__test__`, which is not stubbed). The comment in the Mypy configuration that said the module has no stubs is therefore no longer accurate and is dropped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
nstarman
marked this pull request as ready for review
October 7, 2026 15:45
taldcroft
removed their request for review
October 8, 2026 10:26
This branch has not been deployed
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.
Adds a type stub for the
scalar_inv_efuncsCython module, so that Mypy cansee the signatures of the inverse-efunc functions that the FLRW cosmology
classes call. There are 30 public functions; the stub was generated from the
.pyxsignatures (double->float,int->int,list->list[float]).listis deliberately not widened toSequence, because the Cython argumentis declared as
listand rejects tuples and arrays at runtime.The stub was checked with
stubtestagainst the compiled module, and it isincluded in a non-editable install built from this commit. The only
stubtestmessage is for the Cython-generated
__test__attribute, which I did not stub.The
pyproject.tomlcomment saying that the module "has no stubs for Mypy toread" is no longer true, so this also drops it.
This does not change what CI checks, since
astropy.cosmology._srcis stillexcluded from Mypy. It is groundwork for type-checking
_srcone submodule perPR, following #20556. Once
flrw/*is checked, the stub makes Mypy report about20
[assignment]errors: each subclass assigns functions with differentsignatures to one variable in
if/elifbranches. Those will be fixed with aCallable[..., float]annotation in the follow-up PRs, not here.AI Disclosure
🤖 Generated with Claude Code
I am using the superpowers/brainstorming agent skill to plan a sequence of atomic PRs to fully type annotate
astropy/cosmology/_src, with select small PRs toastropy/unitsas needed.A Claude Opus 5.5 planned the PR sequence. A Sonnet 5.5 is in charge of orchestration, selecting which model is required for each PR. This PR was a Sonnet 5.5.