@@ -375,9 +375,9 @@ def args(self, value: DbtConfiguration | dict[str, t.Any]) -> None: # pyright:
375375 """Set the args for the DbtProject instance and update runtime config."""
376376 if isinstance (value , dict ):
377377 value = dc_replace (self ._args , ** value )
378+ self ._args = value
378379 set_from_args (value , None ) # pyright: ignore[reportArgumentType]
379380 self .parse_project (write_manifest = True , reparse_configuration = True )
380- self ._args = value
381381
382382 def set_args (self , ** kwargs : t .Any ) -> None :
383383 """Set the args for the DbtProject instance."""
@@ -519,10 +519,19 @@ def parse_project(
519519 ) -> None :
520520 """Parse the dbt project and load manifest."""
521521 if reparse_configuration :
522- self ._args = dc_replace (
523- self ._args ,
524- profiles_dir = _get_profiles_dir (self .project_root ),
525- )
522+ current = Path (self ._args .profiles_dir ).resolve ()
523+ standard_dirs = {
524+ self .project_root .resolve (),
525+ (Path .home () / ".dbt" ).resolve (),
526+ }
527+ env_dir = os .environ .get ("DBT_PROFILES_DIR" )
528+ if env_dir :
529+ standard_dirs .add (Path (env_dir ).expanduser ().resolve ())
530+ if current in standard_dirs :
531+ self ._args = dc_replace (
532+ self ._args ,
533+ profiles_dir = _get_profiles_dir (self .project_root ),
534+ )
526535 self .runtime_config = RuntimeConfig .from_args (self ._args )
527536 self .__manifest_loader = ManifestLoader (
528537 self .runtime_config ,
0 commit comments