File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,9 +106,24 @@ def __init__(
106106 if self ._package_name is None : # resolve package name from project metadata if not specified
107107 self ._package_name = toml .load (self ._project_path / "pyproject.toml" )["tool" ]["kedro" ]["package_name" ]
108108
109+ if not getattr (self , "_project_name" , None ): # resolve project name from project metadata if not specified
110+ self ._project_name = toml .load (self ._project_path / "pyproject.toml" )["tool" ]["kedro" ]["project_name" ]
111+
112+ try :
113+ dist = packaging .get_dist (self ._package_name .split ("." )[0 ])
114+ except importlib_metadata .PackageNotFoundError as e :
115+ # Fallback: look up the distribution metadata by project name instead
116+ # (useful in case the package name doesn't match the dist name exactly)
117+ dist = packaging .get_dist (self ._project_name )
118+
119+ self ._store ["dist" ] = {
120+ "name" : dist .name ,
121+ "version" : dist .version ,
122+ }
123+
109124 self ._store ["pkg" ] = {
110125 "name" : self ._package_name ,
111- "version" : packaging . get_dist ( self . _package_name . split ( "." )[ 0 ]) .version ,
126+ "version" : dist .version ,
112127 }
113128
114129 self ._store ["timestamp" ] = {
You can’t perform that action at this time.
0 commit comments