Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 1 addition & 5 deletions python/private/pypi/extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions tests/pypi/extension/extension_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down