@@ -307,6 +307,59 @@ leg of the dependency manually. For instance by making
307307perhaps ` apache-airflow-providers-common-sql ` .
308308
309309
310+ (bazel-downloader)=
311+ ### Multi-platform support
312+
313+ Multi-platform support of cross-building the wheels can be done in two ways - either
314+ using {bzl: attr }` experimental_index_url ` for the {bzl: obj }` pip.parse ` bzlmod tag class
315+ or by using the {bzl: attr }` pip.parse.download_only ` setting. In this section we
316+ are going to outline quickly how one can use the latter option.
317+
318+ Let's say you have 2 requirements files:
319+ ```
320+ # requirements.linux_x86_64.txt
321+ --platform=manylinux_2_17_x86_64
322+ --python-version=39
323+ --implementation=cp
324+ --abi=cp39
325+
326+ foo==0.0.1 --hash=sha256:deadbeef
327+ bar==0.0.1 --hash=sha256:deadb00f
328+ ```
329+
330+ ```
331+ # requirements.osx_aarch64.txt contents
332+ --platform=macosx_10_9_arm64
333+ --python-version=39
334+ --implementation=cp
335+ --abi=cp39
336+
337+ foo==0.0.3 --hash=sha256:deadbaaf
338+ ```
339+
340+ With these 2 files your {bzl: obj }` pip.parse ` could look like:
341+ ```
342+ pip.parse(
343+ hub_name = "pip",
344+ python_version = "3.9",
345+ # Tell `pip` to ignore sdists
346+ download_only = True,
347+ requirements_by_platform = {
348+ "requirements.linux_x86_64.txt": "linux_x86_64",
349+ "requirements.osx_aarch64.txt": "osx_aarch64",
350+ },
351+ )
352+ ```
353+
354+ With this, the ` pip.parse ` will create a hub repository that is going to
355+ support only two platforms - ` cp39_osx_aarch64 ` and ` cp39_linux_x86_64 ` and it
356+ will only use ` wheels ` and ignore any sdists that it may find on the PyPI
357+ compatible indexes.
358+
359+ ``` {note}
360+ This is only supported on `bzlmd`.
361+ ```
362+
310363(bazel-downloader)=
311364### Bazel downloader and multi-platform wheel hub repository.
312365
0 commit comments