Compare commits
2 Commits
0e21db41cb
...
919f949d17
Author | SHA1 | Date | |
---|---|---|---|
919f949d17 | |||
7b010266bd |
|
@ -57,6 +57,8 @@ __all__ = [
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
|
import inspect
|
||||||
|
import sys
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
data,
|
data,
|
||||||
|
@ -66,20 +68,30 @@ from ._version import __version__
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
CURRENT_MODULE = sys.modules[__name__]
|
||||||
|
|
||||||
|
|
||||||
def load_backend(name: str) -> object | None:
|
def load_backend(name: str) -> object | None:
|
||||||
try:
|
try:
|
||||||
return importlib.import_module(f'{__name__}.{name}')
|
imported_module = importlib.import_module(f'{__name__}.{name}')
|
||||||
|
CURRENT_MODULE.setmember(name, imported_module)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
'Backend %s could not be imported? Are all module dependencies installed?',
|
'Backend "%s" could not be imported. Are all module dependencies installed?',
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# Import modules
|
# Import modules
|
||||||
|
|
||||||
defi_kraken = load_backend('defi_kraken')
|
backend_modules = [
|
||||||
defi_kucoin = load_backend('defi_kucoin')
|
'defi_kraken',
|
||||||
investbank_nordnet = load_backend('investbank_nordnet')
|
'defi_kucoin',
|
||||||
defi_partisia_blockchain = load_backend('defi_partisia_blockchain')
|
'investbank_nordnet',
|
||||||
|
'defi_partisia_blockchain',
|
||||||
|
]
|
||||||
|
for m in backend_modules:
|
||||||
|
load_backend(m)
|
||||||
|
del m
|
||||||
|
del backend_modules, CURRENT_MODULE
|
||||||
|
|
14
setup.py
14
setup.py
|
@ -76,15 +76,15 @@ with open(PACKAGE_NAME + '/_version.py') as f:
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS_MAIN = [
|
REQUIREMENTS_MAIN = [
|
||||||
'enforce-typing',
|
'enforce-typing',
|
||||||
'python-kucoin',
|
'python-kucoin',
|
||||||
'krakenex',
|
'krakenex',
|
||||||
'frozendict',
|
'frozendict',
|
||||||
'fin-defs @ git+https://gitfub.space/Jmaa/fin-defs.git',
|
'fin-defs @ git+https://gitfub.space/Jmaa/fin-defs.git',
|
||||||
]
|
]
|
||||||
REQUIREMENTS_TEST = [
|
REQUIREMENTS_TEST = [
|
||||||
'pytest',
|
'pytest',
|
||||||
'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader.git',
|
'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader.git',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user