Skip to content

Commit 54aa2dd

Browse files
committed
🔧 Updated import guard in __init__.py
xtl.__init__ - Updated the import guard that was eagerly blacklisting tox - Now the imports are attempted by default, and if a ModuleNotFoundError is raised, then it's ignored based on the caller
1 parent 14da57e commit 54aa2dd

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/xtl/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@
2222

2323
# Import guard for build tools
2424
import sys
25-
if any(tool in arg for tool in ['setuptools', 'pip', 'egg_info', 'bdist_wheel', 'sdist',
26-
'tox']
27-
for arg in sys.argv):
28-
# Skip imports if running any build tools because no dependencies are available
29-
pass
30-
else:
25+
try:
3126
from .config.settings import XTLSettings
3227

3328
settings: XTLSettings = XTLSettings.initialize()
3429
"""
3530
Shared settings across XTL, initialized from ``xtl.toml``.
3631
3732
:meta hide-value:
38-
"""
33+
"""
34+
except ModuleNotFoundError as e:
35+
if any(tool in arg for tool in ['setuptools', 'pip', 'egg_info', 'bdist_wheel',
36+
'sdist', 'tox']
37+
for arg in sys.argv):
38+
# Skip imports if running any build tools because no dependencies are available
39+
pass
40+
else:
41+
raise e

0 commit comments

Comments
 (0)