Skip to content

Commit 37fe3fe

Browse files
authored
Merge branch 'main' into compile-pip
2 parents 3cd9457 + fe88b23 commit 37fe3fe

File tree

12 files changed

+31
-25
lines changed

12 files changed

+31
-25
lines changed

.bazelrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, execute
66
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
7-
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
8-
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
7+
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
8+
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma
99

1010
test --test_output=errors
1111

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
- --profile
3939
- black
4040
- repo: https://github.com/psf/black
41-
rev: 23.1.0
41+
rev: 25.1.0
4242
hooks:
4343
- id: black
4444
- repo: local

examples/bzlmod/py_proto_library/foo_external/py_binary_with_proto.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
if __name__ == "__main__":
44
import my_proto_pb2
5+
56
sys.exit(0)

examples/wheel/lib/module_with_type_annotations.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def function():
1617
return "qux"

examples/wheel/test_publish.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def test_upload_and_query_simple_api(self):
104104
</head>
105105
<body>
106106
<h1>Links for example-minimal-library</h1>
107-
<a href="/packages/example_minimal_library-0.0.1-py3-none-any.whl#sha256=0cbf4ec574676015af595f570caf4ae2812f994f6338e247b002b4e496b6fbd5">example_minimal_library-0.0.1-py3-none-any.whl</a><br>
107+
<a href="/packages/example_minimal_library-0.0.1-py3-none-any.whl#sha256=a73acae23590c7a8d4365c888c1f12f0399b7af27169ea99fc7a00f402833926">example_minimal_library-0.0.1-py3-none-any.whl</a><br>
108108
</body>
109109
</html>"""
110110
self.assertEqual(

examples/wheel/wheel_test.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_py_library_wheel(self):
8585
],
8686
)
8787
self.assertFileSha256Equal(
88-
filename, "0cbf4ec574676015af595f570caf4ae2812f994f6338e247b002b4e496b6fbd5"
88+
filename, "a73acae23590c7a8d4365c888c1f12f0399b7af27169ea99fc7a00f402833926"
8989
)
9090

9191
def test_py_package_wheel(self):
@@ -110,7 +110,7 @@ def test_py_package_wheel(self):
110110
],
111111
)
112112
self.assertFileSha256Equal(
113-
filename, "22aff90dd3c8c30c3ce2b729bb793cab0bd2668a6810de232677a0354ce79cae"
113+
filename, "a76001500453dbd1d778821dcaba165d56db502c854cef9381dd3f8f89caee11"
114114
)
115115

116116
def test_customized_wheel(self):
@@ -144,14 +144,15 @@ def test_customized_wheel(self):
144144
"example_customized-0.0.1.dist-info/entry_points.txt"
145145
)
146146

147+
print(record_contents)
147148
self.assertEqual(
148149
record_contents,
149150
# The entries are guaranteed to be sorted.
150151
b"""\
151152
"examples/wheel/lib/data,with,commas.txt",sha256=9vJKEdfLu8bZRArKLroPZJh1XKkK3qFMXiM79MBL2Sg,12
152153
examples/wheel/lib/data.txt,sha256=9vJKEdfLu8bZRArKLroPZJh1XKkK3qFMXiM79MBL2Sg,12
153154
examples/wheel/lib/module_with_data.py,sha256=8s0Khhcqz3yVsBKv2IB5u4l4TMKh7-c_V6p65WVHPms,637
154-
examples/wheel/lib/module_with_type_annotations.py,sha256=MM2cFQsCBaUnzGiEGT5r07jhKSaCVRh5Paw_YLyrS-w,636
155+
examples/wheel/lib/module_with_type_annotations.py,sha256=2p_0YFT0TBUufbGCAR_u2vtxF1nM0lf3dX4VGeUtYq0,637
155156
examples/wheel/lib/module_with_type_annotations.pyi,sha256=fja3ql_WRJ1qO8jyZjWWrTTMcg1J7EpOQivOHY_8vI4,630
156157
examples/wheel/lib/simple_module.py,sha256=z2hwciab_XPNIBNH8B1Q5fYgnJvQTeYf0ZQJpY8yLLY,637
157158
examples/wheel/main.py,sha256=mFiRfzQEDwCHr-WVNQhOH26M42bw1UMF6IoqvtuDTrw,1047
@@ -205,7 +206,7 @@ def test_customized_wheel(self):
205206
second = second.main:s""",
206207
)
207208
self.assertFileSha256Equal(
208-
filename, "657a938a6fdd6f38bf73d1d91016ffff85d68cf29ca390692a3e9d923dd0e39e"
209+
filename, "941c0d79f4ca67cfa0028248bd0606db7fc69953ff9c7c73ac26a3e6d3c23587"
209210
)
210211

211212
def test_filename_escaping(self):
@@ -277,7 +278,7 @@ def test_custom_package_root_wheel(self):
277278
for line in record_contents.splitlines():
278279
self.assertFalse(line.startswith("/"))
279280
self.assertFileSha256Equal(
280-
filename, "d415edbf8f326161674c1fa260e364dd44f2a0311e2f596284320ea52d2a8bdb"
281+
filename, "7bd959b7efe9e325b30a6559177a1a4f22ac7a68fade310845916276110e9287"
281282
)
282283

283284
def test_custom_package_root_multi_prefix_wheel(self):
@@ -311,7 +312,7 @@ def test_custom_package_root_multi_prefix_wheel(self):
311312
for line in record_contents.splitlines():
312313
self.assertFalse(line.startswith("/"))
313314
self.assertFileSha256Equal(
314-
filename, "6b76a1178c90996feaf3f9417f350c4a67f90f4247647fd4fd552858dc372d4b"
315+
filename, "caf51e22bdcd3c6c766c8903319ce717daeb6caac577d14e16326a8597981854"
315316
)
316317

317318
def test_custom_package_root_multi_prefix_reverse_order_wheel(self):
@@ -345,7 +346,7 @@ def test_custom_package_root_multi_prefix_reverse_order_wheel(self):
345346
for line in record_contents.splitlines():
346347
self.assertFalse(line.startswith("/"))
347348
self.assertFileSha256Equal(
348-
filename, "f976f0bb1c7d753e8c41629d6b79fb09908c6ecd2fec006816879fc86b664f3f"
349+
filename, "9e8c0baa408b829dec691a5e8d3bc040be0bbfcc95c0eee19e1e5ffadea4a059"
349350
)
350351

351352
def test_python_requires_wheel(self):
@@ -370,7 +371,7 @@ def test_python_requires_wheel(self):
370371
""",
371372
)
372373
self.assertFileSha256Equal(
373-
filename, "f3b74ce429c3324b87f8d1cc7dc33be1493f54bb88d546a7d53be7587b82c1a7"
374+
filename, "b47f3eaf4f9fa4685a58c7415ba1feddd39635ae26c18473504f7d7e62e8ce07"
374375
)
375376

376377
def test_python_abi3_binary_wheel(self):

gazelle/python/testdata/dependency_resolution_order/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
# we can still override "third_party.foo.bar"
2323
import third_party.foo.bar
2424

25-
from third_party import baz
26-
2725
import third_party
26+
from third_party import baz
2827

2928
_ = sys
3029
_ = bar

gazelle/python/testdata/py312_syntax/pep_695_type_parameter.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ def search_one_more_level[T](
1717

1818
import _other_module
1919

20-
2120
if __name__ == "__main__":
2221
pass

python/private/pypi/dependency_resolver/dependency_resolver.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ def main(
195195
# and we should copy the updated requirements back to the source tree.
196196
if not absolute_output_file.samefile(requirements_file_tree):
197197
atexit.register(
198-
lambda: shutil.copy(
199-
absolute_output_file, requirements_file_tree
200-
)
198+
lambda: shutil.copy(absolute_output_file, requirements_file_tree)
201199
)
202200
_run_pip_compile(verbose_command=f"{update_command} -- --verbose")
203201
requirements_file_relative_path = Path(requirements_file_relative)

tests/integration/runner.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323

2424
_logger = logging.getLogger(__name__)
2525

26+
2627
class ExecuteError(Exception):
2728
def __init__(self, result):
2829
self.result = result
30+
2931
def __str__(self):
3032
return self.result.describe()
3133

34+
3235
class ExecuteResult:
3336
def __init__(
3437
self,
@@ -83,7 +86,7 @@ def setUp(self):
8386
"TMP": str(self.tmp_dir),
8487
# For some reason, this is necessary for Bazel 6.4 to work.
8588
# If not present, it can't find some bash helpers in @bazel_tools
86-
"RUNFILES_DIR": os.environ["TEST_SRCDIR"]
89+
"RUNFILES_DIR": os.environ["TEST_SRCDIR"],
8790
}
8891

8992
def run_bazel(self, *args: str, check: bool = True) -> ExecuteResult:

tests/no_unsafe_paths/test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ def test_no_unsafe_paths_in_search_path(self):
4040
self.assertEqual(os.path.basename(sys.path[0]), archive)
4141

4242

43-
if __name__ == '__main__':
44-
unittest.main()
43+
if __name__ == "__main__":
44+
unittest.main()

tools/wheelmaker.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,11 @@ def add_recordfile(self):
217217
filename = filename.lstrip("/")
218218
writer.writerow(
219219
(
220-
c
221-
if isinstance(c, str)
222-
else c.decode("utf-8", "surrogateescape")
220+
(
221+
c
222+
if isinstance(c, str)
223+
else c.decode("utf-8", "surrogateescape")
224+
)
223225
for c in (filename, digest, size)
224226
)
225227
)
@@ -604,7 +606,9 @@ def get_new_requirement_line(reqs_text, extra):
604606
# File is empty
605607
# So replace the meta_line entirely, including removing newline chars
606608
else:
607-
metadata = re.sub(re.escape(meta_line) + r"(?:\r?\n)?", "", metadata, count=1)
609+
metadata = re.sub(
610+
re.escape(meta_line) + r"(?:\r?\n)?", "", metadata, count=1
611+
)
608612

609613
maker.add_metadata(
610614
metadata=metadata,

0 commit comments

Comments
 (0)