bazel-contrib / bazel-contrib/rules_python

Make py_wheel warn if BUILD (or other special bazel files) are included

Open
#3,033 2 comments 1 reaction 0 assignees View on GitHub
type: feature request type: pip
Dominant language
Starlark
Stars
688
Forks
721
Avg merge
14h 49m
Merged PRs (30d)
81

Description

We've seen there are wheels that have special bazel build-time artifacts in them, which then interfere with the pip integration. While we should remove these upon consuming a wheel to prevent the problem, the wheels also shouldn't have those files in them to begin with.

Something I wonder is _how_ those files are ending up in wheels? My guess is just naive `glob("**")` somewhere. We can't control other tools to create wheels, but at the least, we can change py_wheel to error or fail if such special files occur.

Hm, I wonder if we could query pypi to see how often the metadata `Generator` value indicates our py_wheel was used.

Special files:

* BUILD
* BUILD.bazel
* WORKSPACE
* WORKSPACE.bazel
* REPO.bazel
* MODULE.bazel
* Auto-generated `__init__.py` files

I include auto-generated init files because I've seen a few wheels (nvidia-something) that had empty `__init__.py` files in places they shouldn't be or made no sense. (they use namespace packages, so such empty init files break things).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.