tree: 5f4295f704c90e74cbea9fb4beb933d5d78d226f [path history] [tgz]
  1. random_number_generator/
  2. .bazelrc
  3. .gitignore
  4. __init__.py
  5. __main__.py
  6. __test__.py
  7. BUILD.bazel
  8. gazelle_python.yaml
  9. README.md
  10. requirements.in
  11. requirements_lock.txt
  12. requirements_windows.txt
  13. WORKSPACE
examples/build_file_generation/README.md

Build file generation with Gazelle

This example shows a project that has Gazelle setup with the rules_python extension, so that targets like py_library and py_binary can be automatically created just by running

bazel run //:requirements.update
bazel run //:gazelle_python_manifest.update
bazel run //:gazelle

As a demo, try creating a __main__.py file in this directory, then re-run that gazelle command. You'll see that a py_binary target is created in the BUILD file.

Or, try importing the requests library in __init__.py. You'll see that deps = ["@pip//pypi__requests"] is automatically added to the py_library target in the BUILD file.

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