Repository navigation
Adjust to numpy dev scalar format - #15065
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.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
|
The diff looks much simpler than I anticipated. Thanks! 🤞 |
|
Well, the main diff from the docs is not yet in there... |
|
If #15096 goes in first, that PR also has to be reverted here. FYI. |
28e80f7 to
cf64e6c
Compare
|
I just rebased and force-pushed to get a fresh test run. If p.s. Very pressed for time right now, so if this doesn't converge easily, happy with #15096 as a stop-gap measure... |
|
Alas... still 95 failed (though 3 of them are from modeling and unrelated). |
|
Looks like we need version check in some places?
|
|
Ah, right, that changed, we didn't make the new |
|
There are 51 failures now (3 unrelated, the rest doctest output comparison failures). I actually don't like the new look in our own doc test output... especially when you print out the WCS... it looks jarring and adds noise to the actual data I am interested in (say, what is the value of CVAL1, without also have to see it is |
ffffe25 to
a6c39c6
Compare
|
The problem with this PR is that all doctests will fail on older numpy. In principle, we can just not run the tests on older versions, but that makes sense only once 2.0 is actually out. I think the logical route is to go with #15096 first, so that things work again, and then do this one once 2.0 is released. |
|
In that case might even want to wait for numpy 2.1 for a chance for users to catch up? Or is that too long? |
I think in the end we are stuck with fixing up after numpy changes here -- which thankfully doesn't happen too often. In terms of approach, to me, it is important that the documentation actually looks like code one would run, which makes me very hesitant to change just showing output to But if there are more such changes, perhaps we should consider more seriously making the doctest output checks more "sloppy" (like with |
| "docs/io/fits/index.rst = numpy<1.25", # NUMPY_LT_1_25 (Issue 14545) | ||
| "docs/io/fits/usage/image.rst = numpy<1.25", # NUMPY_LT_1_25 (Issue 14545) | ||
| "docs/io/fits/usage/unfamiliar.rst = numpy<1.25", # NUMPY_LT_1_25 (Issue 14545) | ||
| "docs/* = numpy>=2.0", # not NUMPY_LT_2_0 (PR 15065) |
There was a problem hiding this comment.
With this comparison, I think even devdeps won't pick them up, right, because dev is less than stable? How do we know they are actually passing in CI?
There was a problem hiding this comment.
In my first run today, some docs tests failed, so I know it works... See also https://github.com/astropy/astropy/actions/runs/9269807248/job/25501391077?pr=15065#step:7:1464, https://github.com/astropy/astropy/actions/runs/9268687018/job/25497881760?pr=15065#step:10:29371. That makes sense, since those are 2.1.dev
However, you are right that the tests do not run on the 2.0rc (i.e., the prereleases daily cron job). If you think it is worth adjusting this accordingly, then I can do that (my sense is to let it be, given that numpy will be out shortly...)
There was a problem hiding this comment.
OK then the comment to wait for numpy 2.0 still stands, and we'll just not have to merge huge refactoring PRs until then, to ensure rebasing this won't be painful. 🤞
There was a problem hiding this comment.
Because we don't require devdeps to pass to allow merge, and this PR basically is saying that we need devdeps to be green because doctest would only run there until numpy 2 is released.
There was a problem hiding this comment.
OK, maybe that's an argument to change the requirements - I don't really want to have to think about this again...
There was a problem hiding this comment.
I say let's do what we can to merge it now if possible.
There was a problem hiding this comment.
So, is your proposal to change it to numpy>=2.0.dev and then we temporarily make devdeps passing required for merging?
There was a problem hiding this comment.
OK, I changed the requirement to 2.0.0rc1, so we get a real failure if something changes.
22858d4 to
4b78dd6
Compare
|
@pllim - the pre-release test in daily cron now indeed includes the doc tests (and passes), so we will get warnings in the unlikely case there is a change to the documentation between now and the official release. |
|
@larrybradley - ah, I see. At some level, no, we do not care - ducktyping is good python practice, after all. And really, even here the only reason we found this is because the doctests cannot both pass with and without bottleneck otherwise. Though of course it is nice if the types astropy itself produces do not depend on what package one happens to have installed! Anyway, I think I'd leave it as it is now... |
|
Re: #15065 (comment) Does this mean the Daily Cron job has to be run now for every PR until numpy 2 is out? 🤔 |
That would be one solution, but so few PRs touch the documentation that I think we could just do without... Obviously, another option is still just to wait for the actual release. |
|
We could temporarily add a predeps job to the regular CI as part of this PR, and then make a reminder issue to remove it after. I think we are still a good 3-4 weeks until numpy 2 is released. Not sure if we need remote data though... astropy/.github/workflows/ci_cron_daily.yml Lines 48 to 53 in 7202529 |
|
How about I change the double run to use astropy/.github/workflows/ci_workflows.yml Lines 93 to 94 in 7202529 EDIT: possibly make that python 312 as well? |
|
OK, I stuck it on the first run with python 3.12 and minimal dependencies. |
|
Removed Extra CI since we just checked that worked. |
7d387fb to
24c6c60
Compare
| # docs. Fine to remove once numpy 2.0 is released (if problematic). | ||
| - name: Python 3.12 with minimal dependencies and full coverage | ||
| linux: py312-test-cov | ||
| linux: py312-test-cov-predeps |
There was a problem hiding this comment.
Maybe this is okay for a few weeks. It is good to have doctest in coverage.
pllim
left a comment
There was a problem hiding this comment.
Thanks! My goal is to retire before Numpy 3 or Python 4 comes out, whichever first.
|
Thanks!! |
DEV NOTE: Do not merge until numpy 2.0 is actually out!
Do not merge until this is merged and available in numpy nightly wheel (when we start to see things fail in devdeps)Structurefor structure units output) - but this should not be part of this PR, so punted to Post-numpy-2.0 changes in repr/str #15793.doctest-plusto ignorenp.float64, etc., in comparing numerical values. 2023-Dec: seems that we are heading to a docs-on-numpy>=2.0 only stateThis is a start to adjusting our tests for the change in how scalars are formatted in NEP 51 - see numpy/numpy#22449
Note that it does not adjust tests ofreprand the documentation yet!Posting this in part to show that outside of
reprthis is not a big deal.In the documentation, one often will have things like
This brings up a more general question of whether we should use this opportunity of the
reprchanging to just return an array scalar (i.e., it would benp.array(5.0)instead). EDIT: this is better discussed elsewhere - see #16508.Fix #15095
Fix #16491