Skip to content

Commit d6c3399

Browse files
authored
Merge pull request #166 from stefanv/eager-disable-with-0
Allow disabled eager loading with EAGER_IMPORT=0
2 parents ccddd44 + 4aead86 commit d6c3399

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ detail](https://scientific-python.org/specs/spec-0001/#type-checkers).
9999

100100
With lazy loading, missing imports no longer fail upon loading the
101101
library. During development and testing, you can set the `EAGER_IMPORT`
102-
environment variable to disable lazy loading.
102+
environment variable to "1" or "true" to disable lazy loading ("0" or "" re-enables lazy loading).
103103

104104
### External libraries
105105

src/lazy_loader/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def __getattr__(name):
9292
def __dir__():
9393
return __all__.copy()
9494

95-
if os.environ.get("EAGER_IMPORT", ""):
95+
eager_import = os.environ.get("EAGER_IMPORT", "") not in ("0", "")
96+
if eager_import:
9697
for attr in set(attr_to_modules.keys()) | submodules:
9798
__getattr__(attr)
9899

0 commit comments

Comments
 (0)