rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

fix(gazelle): delete invalid py_library and use correct NonEmptyAttrs for py_*

Open hunshcn opened this issue 1 year ago • 4 comments

  1. visibility should not be a NonEmptyAttr
  2. when python_generation_mode is set to package, if __init__.py is deleted, the py_library generated for this package before should be deleted automatically.

hunshcn avatar May 08 '24 12:05 hunshcn

changelog has been added.

It requires two test part.

  1. Existing tests to ensure that everything is normal.
  2. Make a empty folder only has BUILD with a py_library rule generated by gazelle before. After gazelle, BUILD will be empty.

But I have no idea who to add test about 2.

hunshcn avatar May 10 '24 03:05 hunshcn

For 2. you should be able to construct a test similar to how we have them in https://github.com/bazelbuild/rules_python/tree/main/gazelle/python/testdata

You can have the bazel file before running gazelle and after running gazelle, where the test framework will ensure that it works as you expect it to.

aignas avatar May 10 '24 04:05 aignas

test added @aignas

hunshcn avatar May 10 '24 05:05 hunshcn

ping @aignas

hunshcn avatar May 13 '24 03:05 hunshcn

could we continue?

hunshcn avatar May 14 '24 07:05 hunshcn