From 765399609955936fef9e7a11f86b4692384180b3 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Tue, 5 May 2026 18:43:44 +0200 Subject: [PATCH 1/2] Put a try-guard around this import for newer pythons --- eessi/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eessi/__init__.py b/eessi/__init__.py index 5284146e..2bf38444 100644 --- a/eessi/__init__.py +++ b/eessi/__init__.py @@ -1 +1,9 @@ -__import__("pkg_resources").declare_namespace(__name__) +# On older python's this is needed for correct installation of a namespace package +# But on newer pythons, there is no pkg_resources anymore +# We pragmatically wrap it in a try-block. It can be removed entirely after we stop supporting +# python 3.6, since then we can simply require a new enough setuptools that this declare_namespace is +# no longer required +try: + __import__("pkg_resources").declare_namespace(__name__) +except: + pass From b979a8ca88dc475af3f6e7797937708e00a028b9 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Tue, 5 May 2026 18:47:11 +0200 Subject: [PATCH 2/2] Be more explicit on the exception --- eessi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi/__init__.py b/eessi/__init__.py index 2bf38444..18c8506f 100644 --- a/eessi/__init__.py +++ b/eessi/__init__.py @@ -5,5 +5,5 @@ # no longer required try: __import__("pkg_resources").declare_namespace(__name__) -except: +except ImportError: pass