Skip to content

Commit 8dbc5e4

Browse files
committed
rephrase and rewrap
1 parent fa8b4ec commit 8dbc5e4

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

src/maintainer/knowledge_base.rst

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,20 +1041,25 @@ by opening a new issue and including ``@conda-forge-admin, please add noarch: py
10411041
Noarch packages with OS-specific dependencies
10421042
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10431043

1044-
It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS (Linux, Windows,
1045-
MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach relies on four concepts:
1046-
1047-
1. Virtual packages. Prefixed with a double underscore, they are used by conda to represent properties of the running system
1048-
as constraints for the solver. We will use ``__linux``, ``__win`` or ``__osx``, which are only present when
1049-
the running platform is Linux, Windows, or MacOS, respectively. ``__unix`` is present in both Linux and MacOS. Note
1050-
that this feature is **only fully available on conda 4.10 or above**.
1051-
2. Jinja conditionals, which can be used to mimic platform selectors.
1044+
It is possible to build ``noarch`` packages with runtime requirements that depend on the target OS
1045+
(Linux, Windows, MacOS), regardless the architecture (amd64, ARM, PowerPC, etc). This approach
1046+
relies on four concepts:
1047+
1048+
1. `Virtual packages <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-virtual.html>`__.
1049+
Prefixed with a double underscore, they are used by conda to represent system properties as
1050+
constraints for the solver at install-time. We will use ``__linux``, ``__win`` or ``__osx``,
1051+
which are only present when the running platform is Linux, Windows, or MacOS, respectively.
1052+
``__unix`` is present in both Linux and MacOS. Note that this feature is **only fully available
1053+
on conda 4.10 or above**.
1054+
2. Jinja ``{% if ... %}`` conditionals, which can be used to mimic platform selectors.
10521055
3. ``conda-forge.ymls``'s :ref:`noarch_platforms` option.
1053-
4. conda-build's ``conda_build_config.yaml`` to create a matrix build that depends on the ``noarch_platforms`` values.
1056+
4. `conda-build variants <https://docs.conda.io/projects/conda-build/en/latest/resources/variants.html>`__.
1057+
We can use ``conda_build_config.yaml`` to create a matrix build that depends on the
1058+
``noarch_platforms`` values.
10541059

1055-
The idea is to generate OS-specific noarch packages for the OS that need different dependencies. Let's say you have a pure
1056-
Python package, perfectly eligible for ``noarch: python``, but on Windows it requires ``windows-only-dependency``. You might
1057-
have something like:
1060+
The idea is to generate different noarch packages for each OS needing different dependencies.
1061+
Let's say you have a pure Python package, perfectly eligible for ``noarch: python``, but on Windows
1062+
it requires ``windows-only-dependency``. You might have something like:
10581063

10591064
.. code-block:: yaml
10601065
:caption: recipe/meta.yaml (original)
@@ -1071,7 +1076,9 @@ have something like:
10711076
- numpy
10721077
- windows-only-dependency # [win]
10731078
1074-
We can replace it with:
1079+
Being non-noarch, this means that the build matrix will include at least 12 outputs: three platforms,
1080+
times four Python versions. This gets worse with arm64, aarch64 and ppc64le in the mix. We can get it down
1081+
to two outputs if replace it with this other approach!
10751082

10761083
.. code-block:: yaml+jinja
10771084
:caption: recipe/meta.yaml (modified)
@@ -1115,11 +1122,12 @@ would never be true). Fortunately, we can change the default behaviour in ``cond
11151122
- linux-64
11161123
- win-64
11171124
1118-
This will provide two runners per package! But since we are using selectors in ``conda_build_config.yaml``,
1119-
only one is true at a time. Perfect! All these changes require a feedstock rerender to be applied. See
1120-
:ref:`dev_update_rerender`.
1125+
This will provide two runners per package! But since we are using selectors in
1126+
``conda_build_config.yaml``, only one is true at a time. Perfect! All these changes require a
1127+
feedstock rerender to be applied. See :ref:`dev_update_rerender`.
11211128

1122-
Last but not least, what if you need conditional dependencies on all three operating systems? Do it like this:
1129+
Last but not least, what if you need conditional dependencies on all three operating systems? Do it
1130+
like this:
11231131

11241132
.. code-block:: yaml+jinja
11251133
:caption: recipe/meta.yaml

0 commit comments

Comments
 (0)