Skip to content

Commit 7609526

Browse files
authored
py_library generated from wheel shouldn't include tests/ folders (#528)
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.
1 parent d2d08a7 commit 7609526

File tree

1 file changed

+9
-1
lines changed
  • python/pip_install/extract_wheels/lib

1 file changed

+9
-1
lines changed

python/pip_install/extract_wheels/lib/bazel.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,15 @@ def generate_build_file_contents(
129129
130130
py_library(
131131
name = "{name}",
132-
srcs = glob(["**/*.py"], exclude=["{entry_point_prefix}*.py"], allow_empty = True),
132+
srcs = glob(
133+
["**/*.py"],
134+
allow_empty = True,
135+
exclude = [
136+
"{entry_point_prefix}*.py",
137+
"tests/**",
138+
"*/tests/**",
139+
],
140+
),
133141
data = glob(["**/*"], exclude={data_exclude}),
134142
# This makes this directory a top-level in the python import
135143
# search path for anything that depends on this.

0 commit comments

Comments
 (0)