gh-1157: Add CosmologyWithInverseComovingDistance protocol#1164
gh-1157: Add CosmologyWithInverseComovingDistance protocol#1164paddyroddy wants to merge 9 commits into
CosmologyWithInverseComovingDistance protocol#1164Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the typing surface around cosmology capabilities by introducing a dedicated CosmologyWithInverseComovingDistance protocol, so consumers can require inv_comoving_distance only where it’s actually needed.
Changes:
- Remove
HasInverseComovingDistancefrom the baseCosmologyprotocol and introduceCosmologyWithInverseComovingDistance. - Update
glass.shells.distance_gridto require the new protocol. - Update test type annotations to reference the new protocol (with one inconsistency noted in review comments).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
glass/cosmology.py |
Splits inverse-comoving-distance capability into a dedicated protocol. |
glass/shells.py |
Tightens distance_grid’s cosmology type requirement to the new protocol and updates its parameter docs. |
tests/core/test_shells.py |
Adjusts test typing imports/annotations to align with the new protocol (needs a small follow-up for consistency). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
connoraird
left a comment
There was a problem hiding this comment.
I'm surised there were no changes needed in the tests but what do I know
So I had previously modified the tests, but reverted these changes due to a Copilot review. |
Description
Adds a
CosmologyWithInverseComovingDistanceprotocol asinv_comoving_distanceisn't used that often.Closes: #1157
Changelog entry
Added: A
CosmologyWithInverseComovingDistanceprotocolChecks