From 8af376fb891c2e5a5a129ed41e9418119e170d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 14:43:40 +0200 Subject: [PATCH 01/13] Document OS-specific approaches for noarch packages --- src/maintainer/knowledge_base.rst | 127 ++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 3d5c42a008..714a17abe5 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1028,10 +1028,137 @@ In order to qualify as a noarch python package, all of the following criteria mu which builds on Linux `and` Windows, with ``build_number`` offsets to create a pair packages, like ``dataclasses``. +.. hint:: + + You can build platform-specific ``noarch`` packages to include runtime requirements depending on the target OS. + See mini-tutorial below. + If an existing python package qualifies to be converted to a noarch package, you can request the required changes by opening a new issue and including ``@conda-forge-admin, please add noarch: python``. +.. _os_specific_noarch: + +Noarch packages with OS-specific dependencies +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS (Linux, Windows, +MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach relies on four concepts: + +1. Virtual packages. Prefixed with a double underscore, they are used by conda to represent properties of the running system + as constraints for the solver. We will use ``__linux``, ``__win`` or ``__osx``, which are only present when + the running platform is Linux, Windows, or MacOS, respectively. ``__unix`` is present in both Linux and MacOS. Note + that this feature is **only fully available on conda 4.10 or above**. +2. Jinja conditionals, which can be used to mimic platform selectors. +3. ``conda-forge.ymls``'s :ref:`noarch_platforms` option. +4. conda-build's ``conda_build_config.yaml`` to create a matrix build that depends on the ``noarch_platforms`` values. + +The idea is to generate OS-specific noarch packages for the OS that need different dependencies. Let's say you have a pure +Python package, perfectly eligible for ``noarch: python``, but on Windows it requires ``windows-only-dependency``. You might +have something like: + +.. code-block:: yaml + + # recipe/meta.yaml + name: package + source: + ... + build: + number: 0 + requirements: + ... + run: + - python + - numpy + - windows-only-dependency # [win] + +We can replace it with: + +.. code-block:: yaml + + # recipe/meta.yaml + name: package + source: + ... + build: + number: 0 + noarch: python + requirements: + ... + run: + - python + - numpy + - __{{ target_os }} + {% if target_os == 'win' %} + - windows-only-dependency + {% endif %} + +Cool! Where does ``target_os`` come from? We need to define it in ``conda_build_config.yaml``. +Note how the values have been chosen carefully so they match the virtual packages names: + +.. code-block:: yaml + + # recipe/conda_build_config.yaml + target_os: + - unix # [unix] + - win # [win] + +By default, conda-forge will only build ``noarch`` packages on a ``linux-64`` CI runner, so +the ``target_os`` matrix would only provide the ``unix`` value (because the ``# [win]`` selector +would never be true). Fortunately, we can change the default behaviour in ``conda-forge.yml``: + +.. code-block:: yaml + + # conda-forge.yml + noarch_platforms: + - linux-64 + - win-64 + +This will provide two runners per package! But since we are using selectors in ``conda_build_config.yaml``, +only one is true at a time. Perfect! All these changes require a feedstock rerender to be applied: +:ref:`_dev_update_rerender`. + +Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this: + +.. code-block:: yaml + + # recipe/meta.yaml + name: package + source: + ... + build: + number: 0 + noarch: python + requirements: + ... + run: + - python + - numpy + - __{{ target_os }} + {% if target_os == 'osx' %} + - osx-only-dependency + {% elif target_os == 'win' %} + - windows-only-dependency + {% else %} + - linux-only-dependency + {% endif %} + +.. code-block:: yaml + + # recipe/conda_build_config.yaml + target_os: + - linux # [linux] + - osx # [osx] + - win # [win] + +.. code-block:: yaml + + # conda-forge.yml + noarch_platforms: + - linux-64 + - osx-64 + - win-64 +Again, d Noarch generic -------------- From c33f553d1dd12f7c126aba70e18617ea7316cc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 14:57:23 +0200 Subject: [PATCH 02/13] fix label --- src/maintainer/knowledge_base.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 714a17abe5..4bb04d755c 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1114,8 +1114,8 @@ would never be true). Fortunately, we can change the default behaviour in ``cond - win-64 This will provide two runners per package! But since we are using selectors in ``conda_build_config.yaml``, -only one is true at a time. Perfect! All these changes require a feedstock rerender to be applied: -:ref:`_dev_update_rerender`. +only one is true at a time. Perfect! All these changes require a feedstock rerender to be applied. See +:ref:`dev_update_rerender`. Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this: @@ -1158,7 +1158,8 @@ Last but not least, what if you need conditional dependencies on all three opera - osx-64 - win-64 -Again, d +Again, remember to rerender after adding / modifying these files so the changes are applied. + Noarch generic -------------- From d17fb46ebd7c7d0241401ff7f609bc59ca9196cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 15:01:03 +0200 Subject: [PATCH 03/13] fix yaml blocks --- src/maintainer/knowledge_base.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 4bb04d755c..d1b8f1108a 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1057,15 +1057,15 @@ Python package, perfectly eligible for ``noarch: python``, but on Windows it req have something like: .. code-block:: yaml + :caption: recipe/meta.yaml (original) - # recipe/meta.yaml name: package source: - ... + # ... build: number: 0 requirements: - ... + # ... run: - python - numpy @@ -1074,16 +1074,16 @@ have something like: We can replace it with: .. code-block:: yaml + :caption: recipe/meta.yaml (modified) - # recipe/meta.yaml name: package source: - ... + # ... build: number: 0 noarch: python requirements: - ... + # ... run: - python - numpy @@ -1096,8 +1096,8 @@ Cool! Where does ``target_os`` come from? We need to define it in ``conda_build_ Note how the values have been chosen carefully so they match the virtual packages names: .. code-block:: yaml + :caption: recipe/conda_build_config.yaml - # recipe/conda_build_config.yaml target_os: - unix # [unix] - win # [win] @@ -1107,8 +1107,8 @@ the ``target_os`` matrix would only provide the ``unix`` value (because the ``# would never be true). Fortunately, we can change the default behaviour in ``conda-forge.yml``: .. code-block:: yaml + :caption: conda-forge.yml - # conda-forge.yml noarch_platforms: - linux-64 - win-64 @@ -1120,16 +1120,16 @@ only one is true at a time. Perfect! All these changes require a feedstock reren Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this: .. code-block:: yaml + :caption: recipe/meta.yaml - # recipe/meta.yaml name: package source: - ... + # ... build: number: 0 noarch: python requirements: - ... + # ... run: - python - numpy @@ -1143,16 +1143,16 @@ Last but not least, what if you need conditional dependencies on all three opera {% endif %} .. code-block:: yaml + :caption: recipe/conda_build_config.yaml - # recipe/conda_build_config.yaml target_os: - linux # [linux] - osx # [osx] - win # [win] .. code-block:: yaml + :caption: conda-forge.yml - # conda-forge.yml noarch_platforms: - linux-64 - osx-64 From 99af8f6ed4dbb13109386773acc1ee0bdf3c3c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 15:09:08 +0200 Subject: [PATCH 04/13] add details about build string --- src/maintainer/knowledge_base.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index d1b8f1108a..45a0cd4062 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1081,6 +1081,8 @@ We can replace it with: # ... build: number: 0 + # You can include target_os in the build string for easier identification of builds + string: "{{ target_os }}_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" noarch: python requirements: # ... From fa8b4ec82cac3774289497bb8a8a8e5626a9fa72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 15:14:40 +0200 Subject: [PATCH 05/13] use yaml+jinja --- src/maintainer/knowledge_base.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 45a0cd4062..8fea4c6ef1 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1073,7 +1073,7 @@ have something like: We can replace it with: -.. code-block:: yaml +.. code-block:: yaml+jinja :caption: recipe/meta.yaml (modified) name: package @@ -1121,7 +1121,7 @@ only one is true at a time. Perfect! All these changes require a feedstock reren Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this: -.. code-block:: yaml +.. code-block:: yaml+jinja :caption: recipe/meta.yaml name: package From 8dbc5e4e3e546d624afae4b953254923cf48d6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 15:50:47 +0200 Subject: [PATCH 06/13] rephrase and rewrap --- src/maintainer/knowledge_base.rst | 42 ++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 8fea4c6ef1..f8edf5a271 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1041,20 +1041,25 @@ by opening a new issue and including ``@conda-forge-admin, please add noarch: py Noarch packages with OS-specific dependencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS (Linux, Windows, -MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach relies on four concepts: - -1. Virtual packages. Prefixed with a double underscore, they are used by conda to represent properties of the running system - as constraints for the solver. We will use ``__linux``, ``__win`` or ``__osx``, which are only present when - the running platform is Linux, Windows, or MacOS, respectively. ``__unix`` is present in both Linux and MacOS. Note - that this feature is **only fully available on conda 4.10 or above**. -2. Jinja conditionals, which can be used to mimic platform selectors. +It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS +(Linux, Windows, MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach +relies on four concepts: + +1. `Virtual packages `__. + Prefixed with a double underscore, they are used by conda to represent system properties as + constraints for the solver at install-time. We will use ``__linux``, ``__win`` or ``__osx``, + which are only present when the running platform is Linux, Windows, or MacOS, respectively. + ``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available + on conda 4.10 or above**. +2. Jinja ``{% if ... %}`` conditionals, which can be used to mimic platform selectors. 3. ``conda-forge.ymls``'s :ref:`noarch_platforms` option. -4. conda-build's ``conda_build_config.yaml`` to create a matrix build that depends on the ``noarch_platforms`` values. +4. `conda-build variants `__. + We can use ``conda_build_config.yaml`` to create a matrix build that depends on the + ``noarch_platforms`` values. -The idea is to generate OS-specific noarch packages for the OS that need different dependencies. Let's say you have a pure -Python package, perfectly eligible for ``noarch: python``, but on Windows it requires ``windows-only-dependency``. You might -have something like: +The idea is to generate different noarch packages for each OS needing different dependencies. +Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows +it requires ``windows-only-dependency``. You might have something like: .. code-block:: yaml :caption: recipe/meta.yaml (original) @@ -1071,7 +1076,9 @@ have something like: - numpy - windows-only-dependency # [win] -We can replace it with: +Being non-noarch, this means that the build matrix will include at least 12 outputs: three platforms, +times four Python versions. This gets worse with arm64, aarch64 and ppc64le in the mix. We can get it down +to two outputs if replace it with this other approach! .. code-block:: yaml+jinja :caption: recipe/meta.yaml (modified) @@ -1115,11 +1122,12 @@ would never be true). Fortunately, we can change the default behaviour in ``cond - linux-64 - win-64 -This will provide two runners per package! But since we are using selectors in ``conda_build_config.yaml``, -only one is true at a time. Perfect! All these changes require a feedstock rerender to be applied. See -:ref:`dev_update_rerender`. +This will provide two runners per package! But since we are using selectors in +``conda_build_config.yaml``, only one is true at a time. Perfect! All these changes require a +feedstock rerender to be applied. See :ref:`dev_update_rerender`. -Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this: +Last but not least, what if you need conditional dependencies on all three operating systems? Do it +like this: .. code-block:: yaml+jinja :caption: recipe/meta.yaml From a893f82fc48965e0ffc86eecf396b12f678cc444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 21 Oct 2022 17:24:13 +0200 Subject: [PATCH 07/13] noarch_platforms uses underscores --- src/maintainer/knowledge_base.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index f8edf5a271..6aa4e76994 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1119,8 +1119,8 @@ would never be true). Fortunately, we can change the default behaviour in ``cond :caption: conda-forge.yml noarch_platforms: - - linux-64 - - win-64 + - linux_64 + - win_64 This will provide two runners per package! But since we are using selectors in ``conda_build_config.yaml``, only one is true at a time. Perfect! All these changes require a @@ -1164,9 +1164,9 @@ like this: :caption: conda-forge.yml noarch_platforms: - - linux-64 - - osx-64 - - win-64 + - linux_64 + - osx_64 + - win_64 Again, remember to rerender after adding / modifying these files so the changes are applied. From 00ecadcde49b86e54810a40092e291a114a7bba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Fri, 28 Oct 2022 13:56:08 +0200 Subject: [PATCH 08/13] use selectors and get rid of conda_build_config indirection --- src/maintainer/knowledge_base.rst | 67 +++++++++++-------------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 6aa4e76994..b58e5c99ca 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1043,7 +1043,7 @@ Noarch packages with OS-specific dependencies It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS (Linux, Windows, MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach -relies on four concepts: +relies on three concepts: 1. `Virtual packages `__. Prefixed with a double underscore, they are used by conda to represent system properties as @@ -1051,11 +1051,7 @@ relies on four concepts: which are only present when the running platform is Linux, Windows, or MacOS, respectively. ``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available on conda 4.10 or above**. -2. Jinja ``{% if ... %}`` conditionals, which can be used to mimic platform selectors. -3. ``conda-forge.ymls``'s :ref:`noarch_platforms` option. -4. `conda-build variants `__. - We can use ``conda_build_config.yaml`` to create a matrix build that depends on the - ``noarch_platforms`` values. +2. ``conda-forge.ymls``'s :ref:`noarch_platforms` option. The idea is to generate different noarch packages for each OS needing different dependencies. Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows @@ -1088,32 +1084,25 @@ to two outputs if replace it with this other approach! # ... build: number: 0 - # You can include target_os in the build string for easier identification of builds - string: "{{ target_os }}_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" + # You NEED to include the platform in the build string to avoid hash collisions + string: "unix_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [unix] + string: "win_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [win] noarch: python requirements: # ... run: - python - numpy - - __{{ target_os }} - {% if target_os == 'win' %} - - windows-only-dependency - {% endif %} - -Cool! Where does ``target_os`` come from? We need to define it in ``conda_build_config.yaml``. -Note how the values have been chosen carefully so they match the virtual packages names: - -.. code-block:: yaml - :caption: recipe/conda_build_config.yaml + - __unix # [unix] + - __win # [win] + - windows-only-dependency # [win] - target_os: - - unix # [unix] - - win # [win] +Do not forget to specify the platform virtual packages with their selectors! +Otherwise, the solver will not be able to choose the variants correctly. -By default, conda-forge will only build ``noarch`` packages on a ``linux-64`` CI runner, so -the ``target_os`` matrix would only provide the ``unix`` value (because the ``# [win]`` selector -would never be true). Fortunately, we can change the default behaviour in ``conda-forge.yml``: +By default, conda-forge will only build ``noarch`` packages on a ``linux_64`` CI runner, so +only the ``# [unix]`` selectors would be true. However, we can change this behaviour using +the ``noarch_platforms`` option in ``conda-forge.yml``: .. code-block:: yaml :caption: conda-forge.yml @@ -1122,12 +1111,10 @@ would never be true). Fortunately, we can change the default behaviour in ``cond - linux_64 - win_64 -This will provide two runners per package! But since we are using selectors in -``conda_build_config.yaml``, only one is true at a time. Perfect! All these changes require a +This will provide two runners per package! Perfect! All these changes require a feedstock rerender to be applied. See :ref:`dev_update_rerender`. -Last but not least, what if you need conditional dependencies on all three operating systems? Do it -like this: +If you need conditional dependencies on all three operating systems, this is how you do it: .. code-block:: yaml+jinja :caption: recipe/meta.yaml @@ -1137,28 +1124,20 @@ like this: # ... build: number: 0 + # You NEED to include the platform in the build string to avoid hash collisions + string: "{{ SUBDIR.split('-')[0] }}_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" noarch: python requirements: # ... run: - python - numpy - - __{{ target_os }} - {% if target_os == 'osx' %} - - osx-only-dependency - {% elif target_os == 'win' %} - - windows-only-dependency - {% else %} - - linux-only-dependency - {% endif %} - -.. code-block:: yaml - :caption: recipe/conda_build_config.yaml - - target_os: - - linux # [linux] - - osx # [osx] - - win # [win] + - __linux # [linux] + - __osx # [osx] + - __win # [win] + - linux-only-dependency # [linux] + - osx-only-dependency # [osx] + - windows-only-dependency # [win] .. code-block:: yaml :caption: conda-forge.yml From b43e58b3be1452347d151229925d5c5feb2b6961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Tue, 20 Dec 2022 16:04:39 +0100 Subject: [PATCH 09/13] Update src/maintainer/knowledge_base.rst Co-authored-by: Ryan May --- src/maintainer/knowledge_base.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index b58e5c99ca..6a6ef72134 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1051,7 +1051,7 @@ relies on three concepts: which are only present when the running platform is Linux, Windows, or MacOS, respectively. ``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available on conda 4.10 or above**. -2. ``conda-forge.ymls``'s :ref:`noarch_platforms` option. +2. ``conda-forge.yml``'s :ref:`noarch_platforms` option. The idea is to generate different noarch packages for each OS needing different dependencies. Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows From 6e93d0b8e4a7ea8983093c7927c4e48f7e4c81c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Rodr=C3=ADguez-Guerra?= Date: Wed, 21 Dec 2022 00:21:25 +0100 Subject: [PATCH 10/13] Update knowledge_base.rst --- src/maintainer/knowledge_base.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 6a6ef72134..69bf0380df 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1125,7 +1125,9 @@ If you need conditional dependencies on all three operating systems, this is how build: number: 0 # You NEED to include the platform in the build string to avoid hash collisions - string: "{{ SUBDIR.split('-')[0] }}_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" + string: "linux_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [linux] + string: "osx_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [osx] + string: "win_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [win] noarch: python requirements: # ... From 7b58e00542c0020c99c5847f67a9e7b2834ff4d7 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 15 May 2023 15:32:53 -0500 Subject: [PATCH 11/13] Lower bound on python Co-authored-by: Mark Harfouche --- src/maintainer/knowledge_base.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index 69bf0380df..fd51ccab68 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1089,9 +1089,11 @@ to two outputs if replace it with this other approach! string: "win_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [win] noarch: python requirements: - # ... + host: + - python >=3.7 + # ... run: - - python + - python >=3.7 - numpy - __unix # [unix] - __win # [win] From ca545413e42fd140212ccd74d0fb18c72f510193 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 15 May 2023 15:38:03 -0500 Subject: [PATCH 12/13] Remove hashes for conda-build 3.25.0 --- src/maintainer/knowledge_base.rst | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index fd51ccab68..ffa454877d 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1052,6 +1052,7 @@ relies on three concepts: ``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available on conda 4.10 or above**. 2. ``conda-forge.yml``'s :ref:`noarch_platforms` option. +3. **conda-build 3.25.0 or above** changing the build hash depending on virtual packages used. The idea is to generate different noarch packages for each OS needing different dependencies. Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows @@ -1073,10 +1074,10 @@ it requires ``windows-only-dependency``. You might have something like: - windows-only-dependency # [win] Being non-noarch, this means that the build matrix will include at least 12 outputs: three platforms, -times four Python versions. This gets worse with arm64, aarch64 and ppc64le in the mix. We can get it down -to two outputs if replace it with this other approach! +times four Python versions. This gets worse with ``arm64``, ``aarch64`` and ``ppc64le`` in the mix. +We can get it down to two outputs if replace it with this other approach! -.. code-block:: yaml+jinja +.. code-block:: yaml :caption: recipe/meta.yaml (modified) name: package @@ -1084,9 +1085,6 @@ to two outputs if replace it with this other approach! # ... build: number: 0 - # You NEED to include the platform in the build string to avoid hash collisions - string: "unix_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [unix] - string: "win_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [win] noarch: python requirements: host: @@ -1126,10 +1124,6 @@ If you need conditional dependencies on all three operating systems, this is how # ... build: number: 0 - # You NEED to include the platform in the build string to avoid hash collisions - string: "linux_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [linux] - string: "osx_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [osx] - string: "win_pyh{{ PKG_HASH }}_{{ PKG_BUILDNUM }}" # [win] noarch: python requirements: # ... From 0340b8b46e35913cfd8c426dffdde316654d53e8 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 13 Jun 2023 19:16:04 +0200 Subject: [PATCH 13/13] missing space --- src/maintainer/knowledge_base.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maintainer/knowledge_base.rst b/src/maintainer/knowledge_base.rst index ffa454877d..5c0b56d269 100644 --- a/src/maintainer/knowledge_base.rst +++ b/src/maintainer/knowledge_base.rst @@ -1052,7 +1052,7 @@ relies on three concepts: ``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available on conda 4.10 or above**. 2. ``conda-forge.yml``'s :ref:`noarch_platforms` option. -3. **conda-build 3.25.0 or above** changing the build hash depending on virtual packages used. +3. **conda-build 3.25.0 or above** changing the build hash depending on virtual packages used. The idea is to generate different noarch packages for each OS needing different dependencies. Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows