From d55958b6c185ec79bd7591cd6d9e3dd4ed35b5f1 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 20 Apr 2024 12:39:22 +1100 Subject: [PATCH 1/9] numpy 2.0.0rc migration --- recipe/migrations/numpy2.yaml | 38 ++++++++++++++++++++++++++++++++ recipe/migrations/pypy38.yaml | 3 +++ recipe/migrations/python312.yaml | 3 +++ 3 files changed, 44 insertions(+) create mode 100644 recipe/migrations/numpy2.yaml diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml new file mode 100644 index 0000000000..62d7f29c4e --- /dev/null +++ b/recipe/migrations/numpy2.yaml @@ -0,0 +1,38 @@ +__migrator: + build_number: 1 + kind: version + commit_message: "Rebuild for numpy 2.0" + migration_number: 1 + +# needs to fully reproduce zip of {python, python_impl, numpy} +# in order to build for 2.0 and the 1.x per python version +numpy: + - 1.22 + - 1.22 + - 1.22 + - 1.23 + - 2.0 + - 2.0 + - 2.0 + - 2.0 +python: + - 3.8.* *_cpython + - 3.9.* *_cpython + - 3.10.* *_cpython + - 3.11.* *_cpython + - 3.8.* *_cpython + - 3.9.* *_cpython + - 3.10.* *_cpython + - 3.11.* *_cpython +python_impl: + - cpython + - cpython + - cpython + - cpython + - cpython + - cpython + - cpython + - cpython +channel_sources: + - conda-forge/label/numpy_dev,conda-forge +migrator_ts: 1713572489.295986 diff --git a/recipe/migrations/pypy38.yaml b/recipe/migrations/pypy38.yaml index fd6e6995a5..17941cc263 100644 --- a/recipe/migrations/pypy38.yaml +++ b/recipe/migrations/pypy38.yaml @@ -34,8 +34,11 @@ __migrator: python: - 3.9.* *_73_pypy # [not (osx and arm64)] + - 3.9.* *_73_pypy # [not (osx and arm64)] numpy: # part of a zip_keys: python, python_impl, numpy - 1.22 # [not (osx and arm64)] + - 2.0 # [not (osx and arm64)] python_impl: - pypy # [not (osx and arm64)] + - pypy # [not (osx and arm64)] diff --git a/recipe/migrations/python312.yaml b/recipe/migrations/python312.yaml index 784a0a25d7..3fcacf9ed9 100644 --- a/recipe/migrations/python312.yaml +++ b/recipe/migrations/python312.yaml @@ -31,8 +31,11 @@ __migrator: python: - 3.12.* *_cpython + - 3.12.* *_cpython # additional entries to add for zip_keys numpy: - 1.26 + - 2.0 python_impl: - cpython + - cpython From 93399ad5f68d52c3da3dad3f665dbe898d210b5e Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 20 Apr 2024 19:27:04 +1100 Subject: [PATCH 2/9] build everything against numpy 2.0.0rc1 right away --- recipe/migrations/numpy2.yaml | 16 ++-------------- recipe/migrations/pypy38.yaml | 5 ++--- recipe/migrations/python312.yaml | 5 ++--- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index 62d7f29c4e..0f8eeec68c 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -5,13 +5,9 @@ __migrator: migration_number: 1 # needs to fully reproduce zip of {python, python_impl, numpy} -# in order to build for 2.0 and the 1.x per python version +# in order to override it numpy: - - 1.22 - - 1.22 - - 1.22 - - 1.23 - - 2.0 + - 1.22 # no py38 support for numpy 2.0 - 2.0 - 2.0 - 2.0 @@ -20,19 +16,11 @@ python: - 3.9.* *_cpython - 3.10.* *_cpython - 3.11.* *_cpython - - 3.8.* *_cpython - - 3.9.* *_cpython - - 3.10.* *_cpython - - 3.11.* *_cpython python_impl: - cpython - cpython - cpython - cpython - - cpython - - cpython - - cpython - - cpython channel_sources: - conda-forge/label/numpy_dev,conda-forge migrator_ts: 1713572489.295986 diff --git a/recipe/migrations/pypy38.yaml b/recipe/migrations/pypy38.yaml index 17941cc263..2c618c8989 100644 --- a/recipe/migrations/pypy38.yaml +++ b/recipe/migrations/pypy38.yaml @@ -34,11 +34,10 @@ __migrator: python: - 3.9.* *_73_pypy # [not (osx and arm64)] - - 3.9.* *_73_pypy # [not (osx and arm64)] numpy: # part of a zip_keys: python, python_impl, numpy - - 1.22 # [not (osx and arm64)] - 2.0 # [not (osx and arm64)] python_impl: - pypy # [not (osx and arm64)] - - pypy # [not (osx and arm64)] +channel_sources: + - conda-forge/label/numpy_dev,conda-forge # [not (osx and arm64)] diff --git a/recipe/migrations/python312.yaml b/recipe/migrations/python312.yaml index 3fcacf9ed9..5898f0371c 100644 --- a/recipe/migrations/python312.yaml +++ b/recipe/migrations/python312.yaml @@ -31,11 +31,10 @@ __migrator: python: - 3.12.* *_cpython - - 3.12.* *_cpython # additional entries to add for zip_keys numpy: - - 1.26 - 2.0 python_impl: - cpython - - cpython +channel_sources: + - conda-forge/label/numpy_dev,conda-forge From 0aeca113d6a636e4742f620c8fefe71a9e9e6b30 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 1 May 2024 18:08:37 +1100 Subject: [PATCH 3/9] fix channel_sources ordering; use numpy_rc label --- recipe/migrations/numpy2.yaml | 8 +++++++- recipe/migrations/pypy38.yaml | 2 +- recipe/migrations/python312.yaml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index 0f8eeec68c..513abb5be8 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -3,6 +3,12 @@ __migrator: kind: version commit_message: "Rebuild for numpy 2.0" migration_number: 1 + ordering: + # prefer channels including numpy_rc (otherwise smithy doesn't + # know which of the two values should be taken on merge) + channel_sources: + - conda-forge + - conda-forge/label/numpy_rc,conda-forge # needs to fully reproduce zip of {python, python_impl, numpy} # in order to override it @@ -22,5 +28,5 @@ python_impl: - cpython - cpython channel_sources: - - conda-forge/label/numpy_dev,conda-forge + - conda-forge/label/numpy_rc,conda-forge migrator_ts: 1713572489.295986 diff --git a/recipe/migrations/pypy38.yaml b/recipe/migrations/pypy38.yaml index 2c618c8989..c56b77f2d1 100644 --- a/recipe/migrations/pypy38.yaml +++ b/recipe/migrations/pypy38.yaml @@ -40,4 +40,4 @@ numpy: python_impl: - pypy # [not (osx and arm64)] channel_sources: - - conda-forge/label/numpy_dev,conda-forge # [not (osx and arm64)] + - conda-forge/label/numpy_rc,conda-forge # [not (osx and arm64)] diff --git a/recipe/migrations/python312.yaml b/recipe/migrations/python312.yaml index 5898f0371c..a7f5c4dc85 100644 --- a/recipe/migrations/python312.yaml +++ b/recipe/migrations/python312.yaml @@ -37,4 +37,4 @@ numpy: python_impl: - cpython channel_sources: - - conda-forge/label/numpy_dev,conda-forge + - conda-forge/label/numpy_rc,conda-forge From 35c9f8aebd523739a04d682293418854c75cb666 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 2 May 2024 10:20:33 +1100 Subject: [PATCH 4/9] Provide some more information in commit_message This way it also ends up in the PR body, see https://github.com/regro/cf-scripts/blob/a14a4532d2618fc7721aa6ce959639b3c9769dae/conda_forge_tick/migrators/migration_yaml.py#L311 --- recipe/migrations/numpy2.yaml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index 513abb5be8..ca9f58d6bf 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -1,7 +1,32 @@ __migrator: build_number: 1 kind: version - commit_message: "Rebuild for numpy 2.0" + commit_message: | + Rebuild for numpy 2.0 + + As of version 2.0, the way we build against numpy has changed. In particular, + we no longer need to use the oldest available numpy version at build time + in order to support old numpy version at runtime - numpy will by default + use a compatible ABI for the oldest still-supported numpy versions. + + Additionally, we no longer need to use `{{ pin_compatible("numpy") }}` as a + run requirement - this has been handled for more than two years now by a + run-export on the numpy package itself. The migrator will therefore remove + any occurrences of this. + + However, by default, building against numpy 2.0 will assume that the package + is compatible with numpy 2.0, which is not necessarily the case. You should + check that the upstream package explicitly supports numpy 2.0, otherwise you + need to add a `- numpy <2` run requirement until that happens (check numpy + issue 26191 for an overview of the most important packages). + + Finally, numpy 2.0 has not yet been released, but there is a release candidate + that promises to be ABI-compatible with the final release. This means we can + build against numpy 2.0.0rc1 (which can only be installed using a special channel + to opt in, i.e. `conda install -c conda-forge/label/numpy_rc numpy=2.0`), and yet + produce packages that are compatible with older numpy versions and therefore can + be published to our main channels. + migration_number: 1 ordering: # prefer channels including numpy_rc (otherwise smithy doesn't From 223f244d4ff1255347f2f6815cfa641476b944eb Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 3 May 2024 07:48:17 +1100 Subject: [PATCH 5/9] add TL;DR, To-Dos, how-to-use-2.0 & request to keep PR open in case of failures --- recipe/migrations/numpy2.yaml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index ca9f58d6bf..0bbde2c3b7 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -4,10 +4,15 @@ __migrator: commit_message: | Rebuild for numpy 2.0 - As of version 2.0, the way we build against numpy has changed. In particular, - we no longer need to use the oldest available numpy version at build time - in order to support old numpy version at runtime - numpy will by default - use a compatible ABI for the oldest still-supported numpy versions. + TL;DR: The way we build against numpy has changed as of numpy 2.0. This bot + PR has updated the recipe to account for the changes (see below for details). + The numpy 2.0 package itself is currently only available from a special release + channel (`conda-forge/label/numpy_rc`) and will not be available on the main + `conda-forge` channel until the release of numpy 2.0 GA. + + The biggest change is that we no longer need to use the oldest available numpy + version at build time in order to support old numpy version at runtime - numpy + will by default use a compatible ABI for the oldest still-supported numpy versions. Additionally, we no longer need to use `{{ pin_compatible("numpy") }}` as a run requirement - this has been handled for more than two years now by a @@ -22,10 +27,23 @@ __migrator: Finally, numpy 2.0 has not yet been released, but there is a release candidate that promises to be ABI-compatible with the final release. This means we can - build against numpy 2.0.0rc1 (which can only be installed using a special channel - to opt in, i.e. `conda install -c conda-forge/label/numpy_rc numpy=2.0`), and yet - produce packages that are compatible with older numpy versions and therefore can - be published to our main channels. + build against numpy 2.0.0rc1, and yet produce packages that are compatible + with older numpy versions and therefore can be published to our main channels. + If you already want to use the numpy 2.0 release candidate yourself, you can do + ``` + conda config --add channels conda-forge/label/numpy_rc + ``` + or add this channel to your `.condarc` file directly. + + To-Dos: + * [ ] Confirm upstream package is compatible with numpy 2.0, or add `numpy <2` upper bound in `run`. + * [ ] Remove any remaining occurrences of `{{ pin_compatible("numpy") }}` that the bot may have missed. + + PS. If the build does not compile anymore, this is almost certainly a sign that + the upstream project is not yet ready for numpy 2.0; do not close this PR until + a version compatible with numpy 2.0 has been released upstream and on this + feedstock (in the meantime, you can keep the bot from reopening this PR in + case of git conflicts by marking it as a draft). migration_number: 1 ordering: From 9ffa28ba7633101f12701b1b271bcc1c893e6a35 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 3 May 2024 10:26:17 +1100 Subject: [PATCH 6/9] shorten text a bit --- recipe/migrations/numpy2.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index 0bbde2c3b7..b84fefe227 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -25,10 +25,10 @@ __migrator: need to add a `- numpy <2` run requirement until that happens (check numpy issue 26191 for an overview of the most important packages). - Finally, numpy 2.0 has not yet been released, but there is a release candidate - that promises to be ABI-compatible with the final release. This means we can - build against numpy 2.0.0rc1, and yet produce packages that are compatible - with older numpy versions and therefore can be published to our main channels. + Note that the numpy release candidate promises to be ABI-compatible with the + final 2.0 release. This means that building against 2.0.0rc1 produces packages + that can be published to our main channels. + If you already want to use the numpy 2.0 release candidate yourself, you can do ``` conda config --add channels conda-forge/label/numpy_rc From 8dc036b3ce3bad5d835b9a5f42478dc1527c3222 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 May 2024 08:01:19 +1100 Subject: [PATCH 7/9] rewrite To-Dos to make it clearer how to sync with upstream --- recipe/migrations/numpy2.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index b84fefe227..52f6cb4bd8 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -36,7 +36,10 @@ __migrator: or add this channel to your `.condarc` file directly. To-Dos: - * [ ] Confirm upstream package is compatible with numpy 2.0, or add `numpy <2` upper bound in `run`. + * [ ] Match run-requirements for numpy (i.e. check upstream `pyproject.toml` or however the project specifies numpy compatibility) + * If upstream is not yet compatible with numpy 2.0, add `numpy <2` upper bound under `run:`. + * If upstream is already compatible with numpy 2.0, nothing else should be necessary in most cases. + * If upstream requires a minimum numpy version newer than 1.19, you can add `numpy >=x.y` under `run:`. * [ ] Remove any remaining occurrences of `{{ pin_compatible("numpy") }}` that the bot may have missed. PS. If the build does not compile anymore, this is almost certainly a sign that From cffb06cf4deaa82d7718cbd7443ab70c66199a41 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 May 2024 08:17:26 +1100 Subject: [PATCH 8/9] exclude PyPy from numpy 2.0 migration --- recipe/migrations/pypy38.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipe/migrations/pypy38.yaml b/recipe/migrations/pypy38.yaml index c56b77f2d1..fd6e6995a5 100644 --- a/recipe/migrations/pypy38.yaml +++ b/recipe/migrations/pypy38.yaml @@ -36,8 +36,6 @@ python: - 3.9.* *_73_pypy # [not (osx and arm64)] numpy: # part of a zip_keys: python, python_impl, numpy - - 2.0 # [not (osx and arm64)] + - 1.22 # [not (osx and arm64)] python_impl: - pypy # [not (osx and arm64)] -channel_sources: - - conda-forge/label/numpy_rc,conda-forge # [not (osx and arm64)] From d5925f2a2480df860c769eeb8f040b2b72fdd7af Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 May 2024 08:24:35 +1100 Subject: [PATCH 9/9] turn To-Dos into a heading --- recipe/migrations/numpy2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/migrations/numpy2.yaml b/recipe/migrations/numpy2.yaml index 52f6cb4bd8..3221c08888 100644 --- a/recipe/migrations/numpy2.yaml +++ b/recipe/migrations/numpy2.yaml @@ -35,7 +35,7 @@ __migrator: ``` or add this channel to your `.condarc` file directly. - To-Dos: + ### To-Dos: * [ ] Match run-requirements for numpy (i.e. check upstream `pyproject.toml` or however the project specifies numpy compatibility) * If upstream is not yet compatible with numpy 2.0, add `numpy <2` upper bound under `run:`. * If upstream is already compatible with numpy 2.0, nothing else should be necessary in most cases.