You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TST: Handle new numpy 2.0.dev string representation #210
____________________________ [doctest] module2.foo _____________________________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> foo(1, 2)
Expected:
3.0
Got:
np.float64(3.0)
module2.py:None: DocTestFailure
Shall we do the easy thing with the legacy printoption, or you rather suggest to make a new directive that does this flexibly? (I suppose we need to do the printoption either way to fix the CI, but for downstream, it maybe useful to have a directive? Or should they all just update the reprs?
I have mixed feeling about the new printout. This extra np.float64(...) really messes up the WCS print over at astropy.wcs. I wish there is a way to opt out permanently (not just temporarily).
@pllim IDK how astropy.wcs works, but would it work to redefine the __print__ and/or __repr__ definitions to cast to python numeric types before printing (leaving the underlying object(s) as a numpy dtype)?
There is a !r there, if you know you got a numerical value, using !s should be fine? I don't care about making it more permanent, although i would care a bit about making printoption saner (e.g. context safe).
@pllim - I don't think it's necessary to push hot fixes like this, as 1) the failing cron only an effect in our internal testing 2) we still don't provide a solution for downstream.
Besides, leaving an explicit dev version would be helpful while one is in the middle of the dev cycle.
Do we still need this? I mean the numpy <2 support window is fast approaching, and it doesn't look like there is a huge interest in implementing the dual approach.
Hmm I didn't explicitly request supporting both in the original post. As long as we revert that, I think by now, it is reasonable to only support numpy>=2. Thanks!
Activity
bsipocz commentedon Aug 1, 2023
Shall we do the easy thing with the legacy printoption, or you rather suggest to make a new directive that does this flexibly? (I suppose we need to do the printoption either way to fix the CI, but for downstream, it maybe useful to have a directive? Or should they all just update the reprs?
cc @seberg
pllim commentedon Aug 1, 2023
I have mixed feeling about the new printout. This extra
np.float64(...)really messes up the WCS print over atastropy.wcs. I wish there is a way to opt out permanently (not just temporarily).drammock commentedon Aug 1, 2023
@pllim IDK how
astropy.wcsworks, but would it work to redefine the__print__and/or__repr__definitions to cast to python numeric types before printing (leaving the underlying object(s) as a numpy dtype)?pllim commentedon Aug 1, 2023
Re: WCS -- Maybe but it is just a small portion of things that would be similarly affected. For us downstream that don't see the point of extra stuff in printouts, this seems like busywork that we don't have time for. I think one of the WCS printout code is at https://github.com/astropy/astropy/blob/8ab8208a4df5c636054f07c763006324d245ddbd/astropy/wcs/wcs.py#L3116
pllim commentedon Aug 1, 2023
But that said, I'll check out what Marten has worked out at astropy/astropy#15065 though so far he didn't touch WCS.
seberg commentedon Aug 1, 2023
There is a
!rthere, if you know you got a numerical value, using!sshould be fine? I don't care about making it more permanent, although i would care a bit about making printoption saner (e.g. context safe).pllim commentedon Aug 20, 2023
I thought we ignored it but it came back last night (https://github.com/scientific-python/pytest-doctestplus/actions/runs/5915248667/job/16041319959). So I took the liberty to relax the numpy-dev version check directly on main at 91104d8 since it is Sunday morning and I don't have much time. FYI.
bsipocz commentedon Aug 22, 2023
@pllim - I don't think it's necessary to push hot fixes like this, as 1) the failing cron only an effect in our internal testing 2) we still don't provide a solution for downstream.
Besides, leaving an explicit dev version would be helpful while one is in the middle of the dev cycle.
bsipocz commentedon Jan 25, 2025
Do we still need this? I mean the numpy <2 support window is fast approaching, and it doesn't look like there is a huge interest in implementing the dual approach.
pllim commentedon Jan 27, 2025
Did we ever revert #211 ? I think some action is still needed if not?
pllim commentedon Jan 27, 2025
Still here:
pytest-doctestplus/tests/conftest.py
Lines 9 to 12 in c1f124c
bsipocz commentedon Jan 27, 2025
Ahh, yes, sure we will need changes to support >2+, my understanding was that this issue was about supporting both types of representations.
pllim commentedon Jan 27, 2025
Hmm I didn't explicitly request supporting both in the original post. As long as we revert that, I think by now, it is reasonable to only support numpy>=2. Thanks!
flying-sheep commentedon May 8, 2025
Aw, would have loved this to exist.
But only 4 months until the last numpy 1 version’s support window is over so I get it.