@@ -147,6 +147,8 @@ async def cli(ctx, config: List[str], env_file: List[str], logging_config: str):
147147 load_dotenv (env_path , override = True )
148148
149149 _config = DipDupConfig .load (config )
150+ # NOTE: Imports will be loaded later if needed
151+ _config .initialize (skip_imports = True )
150152 init_sentry (_config )
151153
152154 try :
@@ -160,6 +162,7 @@ async def cli(ctx, config: List[str], env_file: List[str], logging_config: str):
160162 reindex = spec_reindex_mapping [__spec_version__ ]
161163 raise MigrationRequiredError (_config .spec_version , __spec_version__ , reindex )
162164
165+ # NOTE: Ensure that no deprecated handlers left in project after migration to v3.0.0
163166 if ctx .invoked_subcommand != 'migrate' :
164167 handlers_path = join (_config .package_path , 'handlers' )
165168 if set (listdir (handlers_path )).intersection (set (deprecated_handlers )):
@@ -206,7 +209,6 @@ async def run(
206209@cli_wrapper
207210async def init (ctx , overwrite_types : bool ):
208211 config : DipDupConfig = ctx .obj .config
209- config .initialize (skip_imports = True )
210212 dipdup = DipDup (config )
211213 await dipdup .init (overwrite_types )
212214
@@ -216,7 +218,6 @@ async def init(ctx, overwrite_types: bool):
216218@cli_wrapper
217219async def migrate (ctx ):
218220 config : DipDupConfig = ctx .obj .config
219- config .initialize (skip_imports = True )
220221 migrations = DipDupMigrationManager (config , ctx .obj .config_paths )
221222 await migrations .migrate ()
222223
0 commit comments