cosmo: refactor layout, deprecate semi-private modules, add new io module#17543
cosmo: refactor layout, deprecate semi-private modules, add new io module#17543nstarman merged 28 commits intoastropy:mainfrom
Conversation
|
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.
|
1d0bf4f to
4cdf60a
Compare
735d327 to
d6fd077
Compare
fd3876e to
3ea2634
Compare
|
@mhvk everything is working except an annoying sphinx warning about |
|
@mhvk, do you want me to edit the commit history in any way to make review easier? |
neutrinoceros
left a comment
There was a problem hiding this comment.
Thank you for carefully splitting this PR into atomic commits, it made reviewing, while somewhat tedious[^1], all the less confusing ! I also really like how the PR itself is atomic in a somewhat different sense; the merge commit will bring together all moving parts in a single clean go.
All of this seems reasonable to me, and I can certainly get behind your initial motivation for it; it's been brought up time and time again that the public/private boundary in this code base isn't clear to all users and caused both confusion and despair from both sides of the community (end users and core devs).
My one important concern is about deprecation warnings: I think we should avoid making any promises about when these deprecation will end (you never know if you'll be able to keep it, and even when it's possible to, we can also forget about it). On the other hand, it would be helpful to specify the "since" part of these messages.
Deprecated modules' docstrings should also avoid promising 8.0 as a due date.
[1]: though I can easily imagine that it's orders of magnitudes less tedious to read than it was to craft !
| pass | ||
|
|
||
| with ( | ||
| warnings.catch_warnings(), |
There was a problem hiding this comment.
could you add a comment here (and in following similar tests) to explain why this filtering is needed ?
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
Signed-off-by: nstarman <[email protected]>
43377ab to
ccab463
Compare
|
My sphinx still wont build docs! Tox, uv, all venvs fail. Perplexing. |
neutrinoceros
left a comment
There was a problem hiding this comment.
Just a quick note to anyone interested: I was going to point out that deprecation warnings were lacking a stacklevel argument, but after experimentation I think only the default value (stacklevel=1) shows the entire message within the traceback, and nothing is gained from using a different value, so, approving as is, thank you !
Since I stepped in as a reviewer at the request of @nstarman in an attempt to relieve @mhvk's burden, I think we should at least wait for his blessing before we merge this.
|
No need to wait for me - for |
|
great ! now we "just" need to fix that RTD failure. |
|
The diff is too big for me to make a reasonable suggestion. But warnings are caused by broken refs. Did you make these "private" and hence undocumented? If so, stop linking to them in the public docs. |
26f4263 to
498e6cb
Compare
|
As a note: current failure is What's mystifying is I have used |
|
I don't think |
|
I see that you attempted |
|
Thanks @neutrinoceros for the review of this large PR! |
astropy.cosmology._utils was renamed to astropy.cosmology._src.utils in astropy/astropy#17543.

@mhvk, as we discussed offline. I've tried to make this change as easy to review as possible by breaking it into a sequence of atomic commits. It looks like there's a lot of line diffs, but actually it's much smaller than that, it's just that doing e.g.
core.py->_src/core.pyand adding a@deprecated(core.py)confuses GH into counting all the lines in the move towards the total.This PR has 3 parts:
move(cosmo): Xcommits move code into a private walled garden, re-exporting them exactly in place. There should be NO impact on (semi-)public API.deprecate(cosmo): Xdeprecates semi-private/semi-public modules. While Astropy states in certain places in the docs that these are private modules which may be moved, in practice they are public and people wrongly import from them directly. Therefore these commits deprecate their contents without removing them, which will happen for Astropy v8.feat: Xcommits add something new and do impact the public API.What does this refactor enable?