Skip to content

Commit 2828f69

Browse files
doc: target_platforms (#3445)
Followup to #3441 adding the documentation on how to use the new attribute. Work towards #2949 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 2a2e136 commit 2828f69

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/pypi/download.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ This will not work for sdists with C extensions, but pure Python sdists may stil
113113
approach.
114114
:::
115115

116+
By default, `rules_python` selects the host `{os}_{arch}` platform from its `MODULE.bazel`
117+
file. This means that `rules_python` by default does not provide cross-platform building support
118+
because some packages have very large wheels and users should be able to use `bazel query` with
119+
minimal overhead. As a result, users should configure their `pip.parse`
120+
calls and select which platforms they want to target via the
121+
{attr}`pip.parse.target_platforms` attribute:
122+
```starlark
123+
# Example of enabling free threaded and non-freethreaded switching on the host platform:
124+
target_platforms = ["{os}_{arch}", "{os}_{arch}_freethreaded"],
125+
126+
# As another example, to enable building for `linux_x86_64` containers and the host platform:
127+
# target_platforms = ["{os}_{arch}", "linux_x86_64"],
128+
)
129+
```
130+
116131
### Using `download_only` attribute
117132

118133
Let's say you have two requirements files:

0 commit comments

Comments
 (0)