modules = [
    "numpy",
    "pandas",
    "statsmodels",
    "scipy",
    "bokeh",
    "markupsafe",
    "ecos",
    "scs",
    "osqp",
    "cvxpy",
    "rqdatac",
    "OpenSSL",
    "cryptography",
    "talib",
    "h5py",
    "hdf5plugin",
    "matplotlib",
    ("rqfactor", [
        "analysis", "engine_v2", "ext", "_dma", "alpha101", "cross_sectional", "exception", "fix", "func",
        "indicators", "interface", "leaf", "rolling", "utils"
    ]),
    ("rqoptimizer", ["benchmark", "const", "constraints", "exception", "helper", "objective", "optimize", "transaction_cost", "utils"]),
    "rqalpha_plus",
    "rqpattr",
]


def import_module(super_module, module):
    def _complete_module(m):
        if super_module:
            return f"{super_module}.{module}"
        return module

    if isinstance(module, str):
        print(_complete_module(module))
        try:
            __import__(_complete_module(module))
        except ModuleNotFoundError:
            return
    elif isinstance(module, tuple):
        module, sub_modules = module
        for sub_module in sub_modules:
            import_module(_complete_module(module), sub_module)
        import_module(super_module, module)
    else:
        raise NotImplementedError(module)


for m in modules:
    import_module(None, m)