Skip to content

Commit

Permalink
py_library generated from wheel shouldn't include tests/ folders (#528)
Browse files Browse the repository at this point in the history
This is a python convention that wheels are shipped to pypi including their tests.
These shouldn't be used in user code.
We have observed these files expose modules which collide with first-party targets.
  • Loading branch information
alexeagle authored Sep 12, 2021
1 parent d2d08a7 commit 7609526
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/pip_install/extract_wheels/lib/bazel.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ def generate_build_file_contents(
py_library(
name = "{name}",
srcs = glob(["**/*.py"], exclude=["{entry_point_prefix}*.py"], allow_empty = True),
srcs = glob(
["**/*.py"],
allow_empty = True,
exclude = [
"{entry_point_prefix}*.py",
"tests/**",
"*/tests/**",
],
),
data = glob(["**/*"], exclude={data_exclude}),
# This makes this directory a top-level in the python import
# search path for anything that depends on this.
Expand Down

0 comments on commit 7609526

Please sign in to comment.