refactor(sphinxdocs): use bazel label format for internal object tracking (#2174)

This changes the way objects are tracked to use Bazel label format
instead of dotted notation.

The dotted notation was problematic because it was ambiguous. For
example, `foo.bar.baz`
could mean `@foo//bar:baz` or `@foo//:bar.bzl%baz`. It also required
various internal hacks
to try and "unparse" the dotted notation into the "meaningful" part of
an object to use
in various contexts. For example, `//foo:bar` usually means `bar` is the
key term to
show, and `//foo:bar.bzl%baz.qux` usually means `qux` or `baz.qux` is
the meaningful part.

Also:
* Make referring to things by the bzl-relative symbol names work. e.g.
`baz.qux` can be
  used to reference `//foo:bar.bzl%baz.qux`
* Fix the name/referencing of runtime_env_toolchains (it was using
singular in the docs)
* Add some more references to bazel inventory
* Omit `--jobs=auto` for `sphinx_run`; multi-job invocations of Sphinx
make it difficult
to interactively run Sphinx for debugging, which is the point of
`sphinx_run`
* Add a basic test of cross-references
* Make xrefs for `--name` format force looking in the flag object type.
This avoids finding
objects of a matching name of another object type; e.g "precompile" is
both a flag and
  attribute name.
* Cleanup the index entries: now the base name is displayed instead of
the full name;
e.g. "foo (target in //bar)" instead of "//foo:bar (target in
//bar:BUILD.bazel)"
10 files changed
tree: 3279b9d93fc36347639644655683749cd040a149
  1. .bazelci/
  2. .bcr/
  3. .ci/
  4. .github/
  5. docs/
  6. examples/
  7. gazelle/
  8. python/
  9. sphinxdocs/
  10. tests/
  11. third_party/
  12. tools/
  13. .bazelignore
  14. .bazelrc
  15. .bazelversion
  16. .git-blame-ignore-revs
  17. .gitattributes
  18. .gitignore
  19. .pre-commit-config.yaml
  20. .readthedocs.yml
  21. addlicense.sh
  22. AUTHORS
  23. BUILD.bazel
  24. BZLMOD_SUPPORT.md
  25. CHANGELOG.md
  26. CONTRIBUTING.md
  27. CONTRIBUTORS
  28. DEVELOPING.md
  29. internal_deps.bzl
  30. internal_setup.bzl
  31. LICENSE
  32. MODULE.bazel
  33. README.md
  34. version.bzl
  35. WORKSPACE
  36. 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.