Skip to content

Coordination: last items before branching 2.0.x #25918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
10 tasks done
rgommers opened this issue Mar 3, 2024 · 26 comments
Closed
10 tasks done

Coordination: last items before branching 2.0.x #25918

rgommers opened this issue Mar 3, 2024 · 26 comments

Comments

@rgommers
Copy link
Member

rgommers commented Mar 3, 2024

Posting as a new issue rather than trying to coordinate with comments on various other PRs. In the community meeting earlier this week we discussed that we are almost ready, and @charris planned to branch maintenance/2.0.x today. We still have a few more things to be done though it looks like.

Here is what I'd propose we do today:

After that (tomorrow?):

Other things:

Everything else under the 2.0.0 milestone seems like it can wait.

@rgommers rgommers added this to the 2.0.0 release milestone Mar 3, 2024
@rgommers
Copy link
Member Author

rgommers commented Mar 3, 2024

I missed a comment from @ngoldbaum elsewhere, so I'll wait for at least his input here before touching the copy keyword issue.

@ngoldbaum
Copy link
Member

I’m going to try to work on a PR to fix the issues with the copy keyword this afternoon. If I can’t figure it out I’ll send in a revert.

@rgommers
Copy link
Member Author

rgommers commented Mar 3, 2024

@charris I'm having a go at release notes updates now.

@charris
Copy link
Member

charris commented Mar 3, 2024

@rgommers Great.

@mattip
Copy link
Member

mattip commented Mar 4, 2024

Wheel building failed, see #25923

@rgommers
Copy link
Member Author

rgommers commented Mar 4, 2024

Restarted nightly wheel builds once more.

@seberg
Copy link
Member

seberg commented Mar 4, 2024

There is one more PR unless it wrecks havoc. The DType ones were a bit stalled, there is a follow up to bump the itemsize to intp and finalize the dtype flags changes.
(I.e. the actual ABI break, I was quite careful to prepare the break in the first PR, but the back and forth delayed the follow up.)

@rgommers
Copy link
Member Author

rgommers commented Mar 4, 2024

Thanks @seberg. Let me ask a few questions to really spell it out, because Chuck was already planning to call it good and create the release branch once the copy keyword regression was fixed.

  1. You still want to get exactly two things in before 2.0.0rc1: MAINT,API: Make metadata, c_metadata, fields, and names only exist on old-style dtypes #25802 and a to-be-opened PR (which I think addresses the second item of In-flight DType change follow-ups #25820)?
  2. Do those two depend on each other?
  3. How much time do you estimate you need?
  4. Is it necessary to do another round of "build nightlies, then build nightlies of scipy straight after, then test scikit-learn/astropy"? (probably yes?) If so, can we do it once both PRs are in (since shepherding all the nightly builds is pretty time-consuming)?

@seberg
Copy link
Member

seberg commented Mar 4, 2024

It shouldn't take long to create the follow up, but right now the most time was always waiting for review (I will skip renaming elsize to itemsize for now to make the change non-huge).

The annoyance is fixing pybind11 and SciPy needs that due to a single line of code:

scipy/spatial/src/distance_pybind.cpp:    desc.element_size = arr.itemsize();

I can even do that, but not quite sure how long review would take.

@rgommers
Copy link
Member Author

rgommers commented Mar 4, 2024

Any chance we can work around that in SciPy? Getting pybind11 to not only fix/review something but do a release that SciPy can use may be difficult.

@seberg
Copy link
Member

seberg commented Mar 4, 2024

Any chance we can work around that in SciPy?

Seems that while pybind11 avoids importing NumPy explicitly, SciPy does not in the module (that I noticed is bad) using pybind11, so using the NumPy provided macros should be trivial, yes.
(I am confused why pybind11 avoids it so much considering SciPy does it...)

@jakevdp
Copy link
Contributor

jakevdp commented Mar 4, 2024

Quick question: over the weekend, our JAX CI jobs running against numpy nightly began failing due to this new error:

In [1]: import numpy as np

In [2]: np.array(0.0, copy=False)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[2], line 1
----> 1 np.array(0.0, copy=False)

ValueError: Unable to avoid copy while creating an array.

I know there's been some work on the copy parameter to asarray and __array__: is this intended? If so, I can update our code to work around it. If not, I can open a bug. Thanks!

@rgommers
Copy link
Member Author

rgommers commented Mar 4, 2024

Yes, that looks expected @jakevdp. For notes on the changes, see

New ``copy`` keyword meaning for ``array`` and ``asarray`` constructors
-----------------------------------------------------------------------
Now `numpy.array` and `numpy.asarray` support three values for ``copy`` parameter:
* ``None`` - A copy will only be made if it is necessary.
* ``True`` - Always make a copy.
* ``False`` - Never make a copy. If a copy is required a ``ValueError`` is raised.
The meaning of ``False`` changed as it now raises an exception if a copy is needed.
(`gh-25168 <https://github.com/numpy/numpy/pull/25168>`__)
The ``__array__`` special method now takes a ``copy`` keyword argument.
-----------------------------------------------------------------------
NumPy will pass ``copy`` to the ``__array__`` special method in situations where
it would be set to a non-default value (e.g. in a call to
``np.asarray(some_object, copy=False)``). Currently, if an
unexpected keyword argument error is raised after this, NumPy will print a
warning and re-try without the ``copy`` keyword argument. Implementations of
objects implementing the ``__array__`` protocol should accept a ``copy`` keyword
argument with the same meaning as when passed to `numpy.array` or
`numpy.asarray`.
(`gh-25168 <https://github.com/numpy/numpy/pull/25168>`__)

This SciPy PR to adapt to the changes may be useful too: scipy/scipy#20172

@seberg
Copy link
Member

seberg commented Mar 4, 2024

The thing that I thought was in the release notes/migration guide: Avoid using array if you have copy=False since asarray is the clearer version. (A long time ago, that had much more overhead, which is probably the main reason why code has it.)

@rgommers
Copy link
Member Author

rgommers commented Mar 4, 2024

The thing that I thought was in the release notes/migration guide: Avoid using array if you have copy=False since asarray is the clearer version

Good point. It's missing from the migration guide, which is the right place I think. I'll take it along in my next PR for release notes updates.

@jakevdp
Copy link
Contributor

jakevdp commented Mar 4, 2024

Thanks!

@rgommers
Copy link
Member Author

rgommers commented Mar 6, 2024

Looks like the last PRs we need are up!

One thing I'd like to suggest is to do a 2.0.0b1 release, which is likely but not guaranteed to have a stable C API and ABI. Doing an rc1 which has a hard guarantee to be stable within days of merging large breaking changes is probably a bit too risky, so it'd be nice to have a 1-2 week escape hatch.

I imagine the following rollout scenario for releases to PyPI:

  1. numpy 2.0.0b1
  2. scipy/pandas/matplotlib/etc. make RC1 releases
  3. announcement that pip install <your-deps> --pre works from PyPI, give a 3-7 day window to catch major issues
  4. numpy 2.0.0rc1 (guaranteed stable now)
  5. scipy/pandas/matplotlib/etc. do a final release, compatible with 2.0 and 1.xx
  6. numpy 2.0.0rc2 (surely we'll need it for something)
  7. numpy 2.0.0

@seberg
Copy link
Member

seberg commented Mar 6, 2024

I am happy with a b1 to not signal ABI stability right away. I don't particularly expect ABI changes (as opposed to API ones; the main place where I see a meaningful ABI break would be the new DType API and nobody will release a new DType in the next month).

@charris
Copy link
Member

charris commented Mar 6, 2024

My impression is that error reports are either immediate, or show up after the first week, so things might move a bit slower than planned. But that is OK as long as something is out there.

We can drop Python 3.9 support in main after the branch, I suggest moving more tests to Python 3.12 where they can hang around for a couple of years.

@charris
Copy link
Member

charris commented Mar 8, 2024

Looks like we are almost ready.

@rgommers
Copy link
Member Author

rgommers commented Mar 8, 2024

Yep, I think once the last release notes PR is merged, the branch can be created.

@seberg
Copy link
Member

seberg commented Mar 9, 2024

You were right, seems if matplotlib is fine (enough). Doc builds are working again and the website is up to date again.

@rgommers
Copy link
Member Author

@seberg are you still planning to make a change in between 2.0.0b1 and 2.0.0rc1 that turns the warning for pybind11 usage of private API into a hard error? Or, since it kinda works for now, do it only in main after pybind11 is fixed up and released?

@seberg
Copy link
Member

seberg commented Mar 10, 2024

🤷 that huge warning is seems only semi-useful, it would be nice to make it a hard error by the time we release, otherwise we don't protect users from potentially bad results/crashes due to a module that wasn't recompiled.
I don't care much about rc1 specifically it just seems like a plausible/reasonable warning shot for pybind11.

@rgommers
Copy link
Member Author

Well, it must be done either before rc1 or not at all. The way it looks now, it actually seems fairly safe to disable the warning, leaving the compat shim in place for 2.0, and make it a hard error on main in a month or so.

Probably best to wait and see how a pybind11 release is coming along, and decide in a week or so?

@rgommers
Copy link
Member Author

The release branch is created and 2.0.0b1 is up on PyPI, so I will close this issue. There are a few things we need to do before 2.0.0rc1, including ones touched upon in this issue, so I will create a new tracking issue for that.

Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants