Skip to content

feat(cosmo): curvature component - #18232

Merged
eerovaher merged 5 commits into
astropy:mainfrom
nstarman:cosmo/traits/curvature
Sep 23, 2025
Merged

eerovaher merged 5 commits into
astropy:mainfrom
nstarman:cosmo/traits/curvature

Conversation

@nstarman

@nstarman nstarman commented Jun 8, 2025

Copy link
Copy Markdown
Member

Working towards #17150
@preshanth hopefully this PR helps!

@nstarman nstarman added this to the v7.2.0 milestone Jun 8, 2025
@nstarman
nstarman requested a review from a team as a code owner June 8, 2025 05:13
@github-actions

github-actions Bot commented Jun 8, 2025

Copy link
Copy Markdown
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.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from fbd5cbb to 833283b Compare June 8, 2025 05:14
@nstarman
nstarman requested a review from eerovaher June 8, 2025 05:16
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch 2 times, most recently from d584836 to a4f9189 Compare June 8, 2025 06:23
@nstarman

nstarman commented Jun 8, 2025

Copy link
Copy Markdown
Member Author

Hm. @eerovaher. I'm seeing some more fun with sphinx and typing. Let's figure it out.

@eerovaher

Copy link
Copy Markdown
Member

You shouldn't have problems with Sphinx anymore now that we don't include type annotations in the API docs.

@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from a4f9189 to 60e01a1 Compare June 10, 2025 19:58
@nstarman

nstarman commented Jun 10, 2025 •

Copy link
Copy Markdown
Member Author

Very nice on one hand. But it's a shame we don't see what's broken (in sphinx) and why. Flying a bit blind.

Comment thread astropy/cosmology/_src/flrw/base.py Resolved
Comment thread astropy/cosmology/_src/flrw/base.py Resolved
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch 2 times, most recently from db45719 to 38bd593 Compare June 11, 2025 15:41
@nstarman
nstarman requested a review from eerovaher June 11, 2025 15:42
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from 38bd593 to adef243 Compare June 11, 2025 18:44
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch 3 times, most recently from d954916 to c246197 Compare June 27, 2025 10:38
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from c246197 to 7757eeb Compare August 23, 2025 23:37
@nstarman
nstarman requested a review from mhvk August 23, 2025 23:37
@nstarman nstarman moved this from Triage to In Progress in Cosmology, the Expansion Aug 25, 2025
@nstarman

Copy link
Copy Markdown
Member Author

Thanks @eerovaher for the review. I think this is ready for round 2.

Comment thread astropy/cosmology/_src/flrw/base.py Resolved
@nstarman
nstarman requested a review from eerovaher August 29, 2025 18:28
@nstarman

nstarman commented Sep 1, 2025

Copy link
Copy Markdown
Member Author

Ping @mhvk @eerovaher for hopefully a final review.

Comment thread astropy/cosmology/_src/traits/hubble.py Resolved
@nstarman
nstarman requested a review from eerovaher September 9, 2025 23:51
@nstarman
nstarman marked this pull request as draft September 11, 2025 14:18
@nstarman

Copy link
Copy Markdown
Member Author

Now blocked by #18546.
I'll rebase and rerun the full CI when that is merged.

@eerovaher

Copy link
Copy Markdown
Member

Now blocked by #18546.

Why?

@nstarman

Copy link
Copy Markdown
Member Author
CleanShot 2025-09-13 at 17 54 37@2x

@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from 6d3b722 to eb8f0cc Compare September 13, 2025 16:20
@nstarman
nstarman marked this pull request as ready for review September 13, 2025 16:20
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from eb8f0cc to 8f89f5c Compare September 20, 2025 19:15
@nstarman
nstarman requested a review from eerovaher September 20, 2025 19:18
@nstarman
nstarman force-pushed the cosmo/traits/curvature branch 2 times, most recently from 010ef06 to 2a14f0f Compare September 21, 2025 18:58
@nstarman

Copy link
Copy Markdown
Member Author

Ping @mhvk @eerovaher for hopefully a final review.

@mhvk mhvk 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.

Looks good to me!

@github-project-automation github-project-automation Bot moved this from In Progress to Reviewer approved in Cosmology, the Expansion Sep 21, 2025
Comment thread pyproject.toml Outdated
"astropy/cosmology/_src/io/builtin/mapping.py = python>=3.12", # not PYTHON_LT_3_12 (PR 17277)
"astropy/cosmology/_src/io/builtin/row.py = python>=3.12", # not PYTHON_LT_3_12 (PR 17277)
"astropy/cosmology/_src/io/builtin/table.py = python>=3.12", # not PYTHON_LT_3_12 (PR 17277)
"astropy/cosmology/_src/traits/curvature.py = numpy>=2", # (PR 18232)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"astropy/cosmology/_src/traits/curvature.py = numpy>=2", # (PR 18232)
"astropy/cosmology/_src/traits/curvature.py = numpy>=2", # not NUMPY_LT_2_0

Mentioning NUMPY_LT_2_0 is useful for grepping. And although I can see that many of the surrounding lines do mention pull requests in their comments, I don't see why that would be useful. If I want to find out when this line was added then I can use git blame.

@nstarman nstarman Sep 22, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SGTM. I'll do both. I find direct references often more convenient than git-blame. But both work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The usefulness of git blame is limited by the quality of commit history and commit messages. Although it is true that in astropy the quality of both is rather low, this sad state of affairs should not be acceptable.

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.

As long as we keep using github, the quality of the commit messages will remain abysmal - it does not encourage writing anything useful. And within the astropy project, there has effectively been a collective decision to not worry about it overly, as improving it costs time that is better spent elsewhere. In that respect, in my experience, one usually just wants to improve the current state, and thus only rarely is there a need for the detailed history. That suggests it is not worth spending a large amount of effort on improving it (admittedly, my only point of comparison is numpy, which is better than astropy, but not by that much).

In this particular case, the most helpful part is not NUMPY_LT_2_0, as it will help our future selves. The rest is a breadcrumb that may or may not be useful.

@nstarman
nstarman force-pushed the cosmo/traits/curvature branch from 2a14f0f to bd26f17 Compare September 22, 2025 22:26
@nstarman
nstarman requested a review from eerovaher September 22, 2025 22:27

@eerovaher eerovaher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Extracting closely related code to separate trait-like classes enables sharing code that should be shared without also having to share code that does not have to be shared. Furthermore, it makes it possible to write and document functions that require its inputs to implement some specific trait without limiting the inputs needlessly. astropy already has a few examples of trait-like classes, such as astropy.utils.shapes.NDArrayShapeMethods or astropy.utils.shapes.ShapedLikeNDArray. It is good to see that cosmology is now making use of that pattern too.

@eerovaher
eerovaher merged commit 042a60a into astropy:main Sep 23, 2025
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in Cosmology, the Expansion Sep 23, 2025
@nstarman
nstarman deleted the cosmo/traits/curvature branch September 23, 2025 14:05
@nstarman nstarman mentioned this pull request Oct 20, 2025
12 of 22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants