Skip to content

Commit aec69f8

Browse files
committed
Log to stderr rather than stdout
1 parent 00df8d0 commit aec69f8

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SPDX-FileCopyrightText: 2025 David Glick <[email protected]>
22
#
33
# SPDX-License-Identifier: MIT
4-
__version__ = "20250404.0"
4+
__version__ = "20250408.0"

src/horse_with_no_namespace/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717

1818
logged = False
1919

20+
2021
def apply():
2122
# The Python site module can call us more than once.
2223
# We need to actually do this the last time,
2324
# But we only want to show the notice once.
2425
global logged
2526
if not logged:
26-
print("🐎 This Python uses horse-with-no-namespace "
27-
"to make pkg_resources namespace packages compatible "
28-
"with PEP 420 namespace packages.")
27+
print(
28+
"🐎 This Python uses horse-with-no-namespace "
29+
"to make pkg_resources namespace packages compatible "
30+
"with PEP 420 namespace packages.",
31+
file=sys.stderr,
32+
)
2933
logged = True
3034

3135
# Only patch pkg_resources if it is installed...
@@ -38,12 +42,15 @@ def apply():
3842
# to update __path__ using pkgutil.extend_path instead
3943
def declare_namespace(packageName):
4044
parent_locals = sys._getframe(1).f_locals
41-
parent_locals["__path__"] = pkgutil.extend_path(parent_locals["__path__"], packageName)
45+
parent_locals["__path__"] = pkgutil.extend_path(
46+
parent_locals["__path__"], packageName
47+
)
48+
4249
pkg_resources.declare_namespace = declare_namespace
4350

4451
# Remove existing namespace package modules that were already created
4552
# by other .pth files, possibly with an incomplete __path__
4653
for name, module in list(sys.modules.items()):
4754
loader = getattr(module, "__loader__", None)
48-
if loader and loader.__class__.__name__ == 'NamespaceLoader':
55+
if loader and loader.__class__.__name__ == "NamespaceLoader":
4956
del sys.modules[name]

0 commit comments

Comments
 (0)