tree: 982f538ba75fa3f8a25785e68c642a0f99e34f1b [path history] [tgz]
  1. other_module/
  2. runfiles/
  3. .bazelignore
  4. .bazelrc
  5. .gitignore
  6. __main__.py
  7. __test__.py
  8. BUILD.bazel
  9. gazelle_python.yaml
  10. lib.py
  11. MODULE.bazel
  12. README.md
  13. requirements.in
  14. requirements_lock.txt
  15. requirements_windows.txt
  16. WORKSPACE
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 requirements.in 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.