Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

examples/basic

The smallest possible setup demonstrating the py plugin: one Python package, stdlib-only imports, a smoke test. No internal cross-package references, no PyPI deps.

Layout

.
├── app.py        # imports json, pathlib, os.path, dataclasses (all stdlib)
├── app_test.py   # imports `app` AND a fixture from `conftest`
├── conftest.py   # shared pytest-style fixtures
├── BUILD.bazel   # gazelle_bin + py_library + py_test + :conftest (generated by gazelle)
└── MODULE.bazel  # rules_python + local_path_override on gazelle_py

What this verifies

  • py_library rule generated with srcs = ["app.py"] and no deps (all imports are stdlib).
  • py_test rule generated with srcs = ["app_test.py"], main = "app_test.py", and deps = [":conftest", ":myapp"] (the sibling library plus the dedicated conftest target, resolved via the first-party RuleIndex and the ancestor-conftest synthesis).
  • conftest.py is extracted into its own py_library named :conftest with testonly = True — NOT bundled into :myapp's srcs (the rules_python-style layout).
  • gazelle:py_visibility //visibility:public directive carries to the library rule.

Try it

bazel run //:gazelle    # generate/update BUILD files
bazel test //...        # run the smoke test

The BUILD.bazel here is checked in pre-generated; running bazel run //:gazelle -- update -mode=diff should report no changes.