diff --git a/CHANGELOG.md b/CHANGELOG.md index ac41e81f6b..69e9330f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,9 @@ Unreleased changes template. * (toolchains) Remove all but `3.8.20` versions of the Python `3.8` interpreter who has reached EOL. If users still need other versions of the `3.8` interpreter, please supply the URLs manually {bzl:ob}`python.toolchain` or {bzl:obj}`python_register_toolchains` calls. +* (pypi) The PyPI extension will no longer write the lock file entries as the + extension has been marked reproducible. + Fixes [#2434](https://github.com/bazel-contrib/rules_python/issues/2434). [20250317]: https://github.com/astral-sh/python-build-standalone/releases/tag/20250317 diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index f782e69a45..8fce47656b 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -419,8 +419,6 @@ You cannot use both the additive_build_content and additive_build_content_file a extra_aliases = {} whl_libraries = {} - is_reproducible = True - for mod in module_ctx.modules: for pip_attr in mod.tags.parse: hub_name = pip_attr.hub_name @@ -458,7 +456,6 @@ You cannot use both the additive_build_content and additive_build_content_file a get_index_urls = None if pip_attr.experimental_index_url: - is_reproducible = False skip_sources = [ normalize_name(s) for s in pip_attr.simpleapi_skip @@ -543,7 +540,6 @@ You cannot use both the additive_build_content and additive_build_content_file a k: dict(sorted(args.items())) for k, args in sorted(whl_libraries.items()) }, - is_reproducible = is_reproducible, ) def _pip_impl(module_ctx): @@ -640,7 +636,7 @@ def _pip_impl(module_ctx): # In order to be able to dogfood the `experimental_index_url` feature before it gets # stabilized, we have created the `_pip_non_reproducible` function, that will result # in extra entries in the lock file. - return module_ctx.extension_metadata(reproducible = mods.is_reproducible) + return module_ctx.extension_metadata(reproducible = True) else: return None diff --git a/tests/pypi/extension/extension_tests.bzl b/tests/pypi/extension/extension_tests.bzl index ab7a1358ad..1652e76156 100644 --- a/tests/pypi/extension/extension_tests.bzl +++ b/tests/pypi/extension/extension_tests.bzl @@ -64,7 +64,6 @@ def _parse_modules(env, **kwargs): return env.expect.that_struct( parse_modules(**kwargs), attrs = dict( - is_reproducible = subjects.bool, exposed_packages = subjects.dict, hub_group_map = subjects.dict, hub_whl_map = subjects.dict, @@ -160,7 +159,6 @@ def _test_simple(env): }, ) - pypi.is_reproducible().equals(True) pypi.exposed_packages().contains_exactly({"pypi": ["simple"]}) pypi.hub_group_map().contains_exactly({"pypi": {}}) pypi.hub_whl_map().contains_exactly({"pypi": { @@ -209,7 +207,6 @@ def _test_simple_multiple_requirements(env): }, ) - pypi.is_reproducible().equals(True) pypi.exposed_packages().contains_exactly({"pypi": ["simple"]}) pypi.hub_group_map().contains_exactly({"pypi": {}}) pypi.hub_whl_map().contains_exactly({"pypi": { @@ -278,7 +275,6 @@ torch==2.4.1 ; platform_machine != 'x86_64' \ }, ) - pypi.is_reproducible().equals(True) pypi.exposed_packages().contains_exactly({"pypi": ["torch"]}) pypi.hub_group_map().contains_exactly({"pypi": {}}) pypi.hub_whl_map().contains_exactly({"pypi": { @@ -404,7 +400,6 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \ simpleapi_download = mocksimpleapi_download, ) - pypi.is_reproducible().equals(False) pypi.exposed_packages().contains_exactly({"pypi": ["torch"]}) pypi.hub_group_map().contains_exactly({"pypi": {}}) pypi.hub_whl_map().contains_exactly({"pypi": { @@ -535,7 +530,6 @@ simple==0.0.3 \ }, ) - pypi.is_reproducible().equals(True) pypi.exposed_packages().contains_exactly({"pypi": ["simple"]}) pypi.hub_group_map().contains_exactly({"pypi": {}}) pypi.hub_whl_map().contains_exactly({"pypi": { @@ -673,7 +667,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef simpleapi_download = mocksimpleapi_download, ) - pypi.is_reproducible().equals(False) pypi.exposed_packages().contains_exactly({"pypi": [ "direct_sdist_without_sha", "direct_without_sha",