Skip to content
Snippets Groups Projects
Commit a00f1514 authored by David Douard's avatar David Douard
Browse files

cli: speedup the `swh` cli command startup time

by moving import statements in functions.

Related to T2575.
parent d1ce9b09
No related branches found
No related tags found
1 merge request!159cli: speedup the `swh` cli command startup time
# Copyright (C) 2018-2019 The Software Heritage developers
# Copyright (C) 2018-2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
# WARNING: do not import unnecessary things here to keep cli startup time under
# control
import os
import logging
from copy import deepcopy
import click
from sqlalchemy import create_engine
from swh.core.cli import CONTEXT_SETTINGS
from swh.lister import get_lister, SUPPORTED_LISTERS, LISTERS
from swh.lister.core.models import initialize
logger = logging.getLogger(__name__)
......@@ -81,6 +81,8 @@ def db_init(ctx, drop_tables):
"""Initialize the database model for given listers.
"""
from sqlalchemy import create_engine
from swh.lister.core.models import initialize
cfg = ctx.obj["config"]
lister_cfg = cfg["lister"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment