tree: ed2b987de9c3f2f2ebdddc1f00e89fd0beacf3ba [search]
  1. other_module/
  2. runfiles/
  3. .bazelignore
  4. .bazelrc
  5. .gitignore
  6. __main__.py
  7. __test__.py
  8. BUILD.bazel
  9. downloader_config.cfg
  10. gazelle_python.yaml
  11. gazelle_python_with_types.yaml
  12. lib.py
  13. MODULE.bazel
  14. pyproject.toml
  15. README.md
  16. uv.lock
  17. WORKSPACE
gazelle/examples/bzlmod_build_file_generation/README.md

Bzlmod build file generation example

This example demostrates how to use rules_python and gazelle with bzlmod enabled. Bzlmod, the new external dependency subsystem, does not directly work with repo definitions. Instead, it builds a dependency graph from modules, runs extensions on top of the graph, and defines repos accordingly.

Gazelle is setup with the rules_python extension, so that targets like py_library and py_binary can be automatically created just by running:

$ bazel run //:gazelle update

The are other targets that allow you to update the gazelle dependency management when you update the pyproject.toml file. See:

bazel run //:gazelle_python_manifest.update

For more information on the behavior of the rules_python gazelle extension, see the README.md file in the /gazelle folder.

This example uses a MODULE.bazel file that configures the bzlmod dependency management. See comments in the MODULE.bazel and BUILD.bazel files for more information.