core: experimental import of my._init_hook to configure logging/warnings/env variables

This commit is contained in:
Dima Gerasimov 2023-06-21 02:58:17 +01:00 committed by karlicoss
parent c12224af74
commit ab7135d42f
2 changed files with 11 additions and 0 deletions

View file

@ -37,3 +37,13 @@ __all__ = [
'dataclass', 'Path',
]
## experimental for now
# you could put _init_hook.py next to your private my/config
# that way you can configure logging/warnings/env variables on every HPI import
try:
import my._init_hook # type: ignore[import]
except:
pass
##

View file

@ -1,5 +1,6 @@
'''
A hook to insert user's config directory into Python's search path.
Note that this file is imported only if we don't have custom user config (under my.config namespace) in PYTHONPATH
Ideally that would be in __init__.py (so it's executed without having to import explicitly)
But, with namespace packages, we can't have __init__.py in the parent subpackage