refactor: explicitly define host platform ordering (#2890)

It turns out the `unsorted-dict-items` disable in versions.bzl is
load-bearing: the
precedence of what host-compatible runtime is selected depends on the
order of keys.
Hence, the keys are carefully defined such that freethreaded and musl
come after the
regular runtimes.

Make this subtle and implicit behavior explicit by having an ordering
function that
sorts keys in the order we want.

Work towards https://github.com/bazel-contrib/rules_python/issues/2081

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
3 files changed
tree: 3246f939ef0f64b876689aa37ab6a44ab8fabefd
  1. .bazelci/
  2. .bcr/
  3. .ci/
  4. .github/
  5. docs/
  6. examples/
  7. gazelle/
  8. private/
  9. python/
  10. sphinxdocs/
  11. tests/
  12. third_party/
  13. tools/
  14. .bazelignore
  15. .bazelrc
  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. AUTHORS
  26. BUILD.bazel
  27. BZLMOD_SUPPORT.md
  28. CHANGELOG.md
  29. CONTRIBUTING.md
  30. CONTRIBUTORS
  31. internal_dev_deps.bzl
  32. internal_dev_setup.bzl
  33. LICENSE
  34. MODULE.bazel
  35. README.md
  36. RELEASING.md
  37. version.bzl
  38. WORKSPACE
  39. 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

  • Status: Beta
  • Full Feature Parity: No

See Bzlmod support for more details.