Skip to content

Add Metadata Attribute to Cosmology - #11542

Merged
mhvk merged 11 commits into
astropy:mainfrom
nstarman:cosmo_add_meta
May 25, 2021
Merged

mhvk merged 11 commits into
astropy:mainfrom
nstarman:cosmo_add_meta

Conversation

@nstarman

@nstarman nstarman commented Apr 13, 2021 •

Copy link
Copy Markdown
Member

Description

Adds metadata to cosmologies. The original motivation was that all the parameter dictionaries for built-in realizations have all this extra info that isn't being used. Let's just stick the extra info in metadata! Seems generically useful for e.g. adding references to user-defined cosmologies.

Should the metadata be mutable? yes, I think this should be the one mutable thing on a cosmology. It is never used by the cosmology.

Ready for review! But plz merge #11540 first. Then I can rebase this since there's some overlap. 🎉
request review: @adrn @mhvk @embray @dhomeier

@pep8speaks

pep8speaks commented Apr 13, 2021 •

Copy link
Copy Markdown

Hello @nstarman 👋! It looks like you've made some changes in your pull request, so I've checked the code again for style.

There are no PEP8 style issues with this pull request - thanks! 🎉

Comment last updated at 2021-05-25 00:38:48 UTC

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@nstarman
nstarman force-pushed the cosmo_add_meta branch 4 times, most recently from 97841ef to 237e4c0 Compare April 16, 2021 06:00
Comment thread astropy/cosmology/core.py Resolved
Comment thread astropy/cosmology/core.py Resolved
Comment thread astropy/cosmology/core.py Resolved
@nstarman
nstarman marked this pull request as ready for review April 17, 2021 03:32
@nstarman nstarman changed the title WIP: Add Metadata Attribute to Cosmology Add Metadata Attribute to Cosmology Apr 17, 2021
@nstarman

Copy link
Copy Markdown
Member Author

@pllim, not v4.3 critical, but IMO this is ready for merge. Hopefully if someone reviews, they'll agree and then this would be nice in v4.3

@pllim

pllim commented Apr 19, 2021

Copy link
Copy Markdown
Member

Not sure who should review here...

@nstarman

Copy link
Copy Markdown
Member Author

The cosmology maintainer 😢

@adrn

adrn commented Apr 30, 2021

Copy link
Copy Markdown
Member

On first glance, looks good, but won't have time to review carefully today. OK to move milestone to 5.0? (unless someone else has time to review today!)

@pllim pllim modified the milestones: v4.3, v5.0 Apr 30, 2021
@pllim

pllim commented Apr 30, 2021

Copy link
Copy Markdown
Member

I tentatively moved the milestone as requested. I'd rather this gets a proper review than to rush things in last minute. If the situation changes, please move the milestone back. Thanks!

Comment thread astropy/cosmology/realizations.py Resolved
@nstarman

Copy link
Copy Markdown
Member Author

ping @adrn. I'm not sure if the 4.3 feature freeze is still in effect, but if it isn't... Thanks!

@pllim

pllim commented May 17, 2021

Copy link
Copy Markdown
Member

Branching happened, so you can merge 5.0 stuff now. FYI.

@nstarman

Copy link
Copy Markdown
Member Author

Request review: @adrn @mhvk @embray @dhomeier

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

This looks very nice! I really only have one rather nitpicky comment, about __all_subclasses__, which seems a bit out of scope here (and possibly not the ideal way to go about it). If we can keep this as a short function for now where it is needed, then I'm happy to get it in.

Comment thread astropy/cosmology/core.py
ba = self._init_signature.bind_partial(**new_init)
except TypeError as e:
# for backward compatibility, map TypeError to AttributeError
warnings.warn("Starting in Astropy v5.0, passing an unrecognized "

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.

For follow-up, we can now get rid of this...

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.

Comment thread astropy/cosmology/realizations.py Resolved

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

LGTM aside from a very minor nitpick! But I agree with @mhvk's points about __all_subclasses__

Comment thread astropy/cosmology/core.py Resolved
@nstarman
nstarman force-pushed the cosmo_add_meta branch 3 times, most recently from 000017e to 4990186 Compare May 24, 2021 18:31
nstarman and others added 11 commits May 24, 2021 20:37
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
also simplify recursion

Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
Co-authored-by: Adrian Price-Whelan <[email protected]>
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>

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

OK, thanks, looks all good now! Merging...

@mhvk
mhvk merged commit b669023 into astropy:main May 25, 2021
@nstarman
nstarman deleted the cosmo_add_meta branch May 25, 2021 03:03
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.

5 participants