Skip to content

Cosmo io private - #14842

Merged
eerovaher merged 3 commits into
astropy:mainfrom
nstarman:cosmo-io-private
Jun 16, 2023
Merged

eerovaher merged 3 commits into
astropy:mainfrom
nstarman:cosmo-io-private

Conversation

@nstarman

@nstarman nstarman commented May 18, 2023 •

Copy link
Copy Markdown
Member

It says in multiple ways that cosmology.io is private: in its absence in the docs, in cosmology.io.__init__.py and that it's not in cosmology.__init__::__all__. This PR helps enforce that.

Also, this PR does some small improvements: renaming arguments and cleaning up imports.

@github-actions

github-actions Bot commented May 18, 2023 •

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 "When to rebase and squash commits".
  • 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?
  • Is a milestone set? Milestone must be set but we cannot check for it on Actions; do not let the green checkmark fool you.
  • 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.

@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-io-private branch 2 times, most recently from 91b4da7 to d8152da Compare May 20, 2023 23:49
@nstarman
nstarman marked this pull request as ready for review May 20, 2023 23:55
@nstarman
nstarman requested a review from a team as a code owner May 20, 2023 23:55
@nstarman
nstarman requested review from WilliamJamieson and removed request for a team May 20, 2023 23:55
@nstarman
nstarman force-pushed the cosmo-io-private branch from b8269ad to f550642 Compare May 25, 2023 19:55
@nstarman
nstarman requested a review from eerovaher May 25, 2023 19:56

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

If astropy.cosmology.io is private then changing its name to make it clearer is a good idea. However, this pull request seems to contain unrelated changes and the documentation build failure looks to be related.

Comment thread astropy/cosmology/_io/mapping.py Resolved
Comment thread astropy/cosmology/tests/test_utils.py Resolved
@nstarman
nstarman requested a review from eerovaher May 27, 2023 02:40

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

There are quite a few instances where comments label astropy.cosmology._io as a third party module, which is not true. I have highlighted one of them, but there are more. I don't think the # THIRD PARTY and # LOCAL comments provide much benefit anyways, at least not if we are using Ruff to keep the imports sorted. It would be simplest to just remove these comments.

Furthermore, f70ba0c should be merged with the commit that broke the documentation build.

@nstarman
nstarman requested review from eerovaher and mhvk June 10, 2023 21:47

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

This is mostly good, but I do have a question about an unused import.

Comment thread astropy/cosmology/realizations.py Resolved
nstarman added 2 commits June 12, 2023 21:25
Signed-off-by: Nathaniel Starkman <[email protected]>
Signed-off-by: Nathaniel Starkman <[email protected]>

update docs

Signed-off-by: Nathaniel Starkman <[email protected]>
@nstarman
nstarman requested a review from eerovaher June 13, 2023 01:27
Comment thread astropy/cosmology/realizations.py Outdated
from astropy.utils.decorators import deprecated
from astropy.utils.state import ScienceState

from . import _io # Register I/O methods for reading builtin realizations # noqa: F401

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.

I can't understand what this comment is trying to say. I would imagine that if we are registering methods from _io then we would access them at the moment of registration, but then the module wouldn't be unused and the noqa instruction wouldn't be needed.

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.

The I/O methods are only registered when the registration code is imported. When trying to read the in-built realizations, it doesn't know about any I/O methods unless _io has been imported first.

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.

I would like to replace the I/O registration with entry-points, but that will require a PR to io/registry.

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.

When trying to read the in-built realizations, it doesn't know about any I/O methods unless _io has been imported first.

So is it the case that the I/O method registration requires a specific module import order and the line here is meant to enforce that? If so then that's what the comment should say.

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.

The import order importance is that ._io is registered before .realizations.

Signed-off-by: Nathaniel Starkman <[email protected]>

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

Looks good to me, but I'll leave the pull request open for a while in case @WilliamJamieson or @mhvk want to have a look at it.

@mhvk

mhvk commented Jun 15, 2023

Copy link
Copy Markdown
Contributor

I still don't really like having private modules (unless they are bindings to C code or so) hence felt I should not review this, as really what counts is not my opinion but whether it works better for cosmology.

@mhvk
mhvk removed their request for review June 15, 2023 16:49
@eerovaher

Copy link
Copy Markdown
Member

I think anybody that would have wanted to say something has had plenty of time to do so, there's no need to delay this any further.

@eerovaher
eerovaher merged commit f837963 into astropy:main Jun 16, 2023
@nstarman
nstarman deleted the cosmo-io-private branch June 17, 2023 04:31
@nstarman

Copy link
Copy Markdown
Member Author

Thanks @eerovaher for the multiple detailed reviews!

@nstarman nstarman mentioned this pull request Jun 25, 2023
3 tasks done
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.

3 participants