Skip to content

Commit 18d0d29

Browse files
rickeylevaignas
andcommitted
fix(pypi): only generate namespace package shims if implicit namespaces are disabled (#3059)
The refactoring to move the pkgutil shim generation to build phase inverted the logic for when it should be activated. When `enable_implicit_namespace_pkgs=True`, it means to not generate the pkgutil shims ("respect the Python definition of the namespace package"). To fix, just invert the logic that activates it. A test will be added in a subsequent PR because the necessary helper isn't in the 1.5 branch. Fixes #3038 --------- Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com> (cherry picked from commit 47c681b)
1 parent 63841ec commit 18d0d29

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ BEGIN_UNRELEASED_TEMPLATE
4747
END_UNRELEASED_TEMPLATE
4848
-->
4949

50+
{#1-5-1}
51+
## [1.5.1] - 2025-07-06
52+
53+
[1.5.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.5.1
54+
55+
{#v1-5-1-fixed}
56+
### Fixed
57+
58+
* (pypi) Namespace packages work by default (pkgutil shims are generated
59+
by default again)
60+
([#3038](https://github.com/bazel-contrib/rules_python/issues/3038)).
61+
5062
{#1-5-0}
5163
## [1.5.0] - 2025-06-11
5264

@@ -70,7 +82,7 @@ END_UNRELEASED_TEMPLATE
7082
* (py_wheel) py_wheel always creates zip64-capable wheel zips
7183
* (providers) (experimental) {obj}`PyInfo.venv_symlinks` replaces
7284
`PyInfo.site_packages_symlinks`
73-
* (deps) Updating setuptools to patch CVE-2025-47273.
85+
* (deps) Updating setuptools to patch CVE-2025-47273. This effectively makes Python 3.9 the minimum supported version for using `pip_parse`.
7486

7587
{#1-5-0-fixed}
7688
### Fixed

python/private/pypi/whl_library_targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def whl_library_targets(
331331
allow_empty = True,
332332
)
333333

334-
if enable_implicit_namespace_pkgs:
334+
if not enable_implicit_namespace_pkgs:
335335
srcs = srcs + getattr(native, "select", select)({
336336
Label("//python/config_settings:is_venvs_site_packages"): [],
337337
"//conditions:default": create_inits(

tests/pypi/whl_library_targets/whl_library_targets_tests.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616

1717
load("@rules_testing//lib:test_suite.bzl", "test_suite")
1818
load("//python/private:glob_excludes.bzl", "glob_excludes") # buildifier: disable=bzl-visibility
19-
load("//python/private/pypi:whl_library_targets.bzl", "whl_library_targets", "whl_library_targets_from_requires") # buildifier: disable=bzl-visibility
19+
load("//python/private/pypi:whl_library_targets.bzl", _whl_library_targets = "whl_library_targets", _whl_library_targets_from_requires = "whl_library_targets_from_requires") # buildifier: disable=bzl-visibility
2020

2121
_tests = []
2222

23+
def whl_library_targets(**kwargs):
24+
# Let's skip testing this for now
25+
_whl_library_targets(enable_implicit_namespace_pkgs = True, **kwargs)
26+
27+
def whl_library_targets_from_requires(**kwargs):
28+
# Let's skip testing this for now
29+
_whl_library_targets_from_requires(enable_implicit_namespace_pkgs = True, **kwargs)
30+
2331
def _test_filegroups(env):
2432
calls = []
2533

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy