feat(pip.parse): limit the target platforms we parse requirements for (#3441)

Up until now the users can configure which requirements files to be used
for specific platforms, however, what they cannot configure is what
target platforms should actually be set up.

The difference in the problems is:
1. I want my `bazel build` to work on `osx aarch64` and `linux x86_64`.
1. I want my `bazel build` to build for `linux x86_64` on `osx aarch64`.

With the newly introduced `target_platforms` attribute users can finally
specify their target platforms. To ensure that this also allows users to
specify that they want to support `freethreaded` and `non-freethreaded`
platforms at the same time we support `{os}` and `{arch}` templating in
the strings.

This should fix the `genquery` usage pattern breakage when we previously
enabled `RULES_PYTHON_ENABLE_PIPSTAR=1`.

Work towards #2949
Work towards #3434

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
7 files changed
tree: 75aff99c195968e2d8278807138395d5cfabaf45
  1. .bazelci/
  2. .bcr/
  3. .ci/
  4. .github/
  5. docs/
  6. examples/
  7. gazelle/
  8. private/
  9. python/
  10. sphinxdocs/
  11. tests/
  12. tools/
  13. .bazelignore
  14. .bazelrc
  15. .bazelrc.deleted_packages
  16. .bazelversion
  17. .editorconfig
  18. .git-blame-ignore-revs
  19. .gitattributes
  20. .gitignore
  21. .pre-commit-config.yaml
  22. .python-version
  23. .readthedocs.yml
  24. addlicense.sh
  25. AGENTS.md
  26. AUTHORS
  27. BUILD.bazel
  28. BZLMOD_SUPPORT.md
  29. CHANGELOG.md
  30. CONTRIBUTING.md
  31. CONTRIBUTORS
  32. GEMINI.md
  33. internal_dev_deps.bzl
  34. internal_dev_setup.bzl
  35. LICENSE
  36. MODULE.bazel
  37. README.md
  38. RELEASING.md
  39. version.bzl
  40. WORKSPACE
  41. WORKSPACE.bzlmod
README.md

Python Rules for Bazel

Build status

Overview

This repository is the home of the core Python rules -- py_library, py_binary, py_test, py_proto_library, and related symbols that provide the basis for Python support in Bazel. It also contains package installation rules for integrating with PyPI and other indices.

Documentation for rules_python is at https://rules-python.readthedocs.io and in the Bazel Build Encyclopedia.

Examples live in the examples directory.

The core rules are stable. Their implementation is subject to Bazel's backward compatibility policy. This repository aims to follow semantic versioning.

The Bazel community maintains this repository. Neither Google nor the Bazel team provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. See How to contribute page for information on our development workflow.

Documentation

For detailed documentation, see https://rules-python.readthedocs.io

Bzlmod support

See Bzlmod support for more details.