@@ -264,16 +264,19 @@ def _update_data_structures(
264264 path_with_extras : PathWithExtras ,
265265 datas : list [dict [str , Any ]], # modified in place
266266 all_extras : list [list [str ]], # modified in place
267- seen : set [PathWithExtras ], # modified in place
267+ seen : set [tuple [ PathWithExtras , ...] ], # modified in place
268268 yaml : YAML ,
269269 is_nested : bool ,
270- origin : Path | None = None ,
270+ origin : PathWithExtras | None = None ,
271271 verbose : bool = False ,
272272) -> None :
273273 if verbose :
274274 print (f"📄 Parsing `{ path_with_extras .path_with_extras } `" )
275275 data = _load (path_with_extras .path , yaml )
276- data ["_origin" ] = origin or path_with_extras .path
276+ if origin is None :
277+ data ["_origin" ] = path_with_extras .path
278+ else :
279+ data ["_origin" ] = origin .path
277280 datas .append (data )
278281 _move_local_optional_dependencies_to_local_dependencies (
279282 data = data , # modified in place
@@ -294,7 +297,11 @@ def _update_data_structures(
294297 verbose = verbose ,
295298 )
296299
297- seen .add (path_with_extras .resolved ())
300+ seen .add (
301+ (origin .resolved (), path_with_extras .resolved ())
302+ if origin is not None
303+ else (path_with_extras .resolved (),),
304+ )
298305
299306 # Handle "local_dependencies" (or old name "includes", changed in 0.42.0)
300307 for local_dependency in _get_local_dependencies (data ):
@@ -381,7 +388,7 @@ def _add_local_dependencies(
381388 path_with_extras : PathWithExtras ,
382389 datas : list [dict [str , Any ]],
383390 all_extras : list [list [str ]],
384- seen : set [PathWithExtras ],
391+ seen : set [tuple [ PathWithExtras , ...] ],
385392 yaml : YAML ,
386393 verbose : bool = False ,
387394) -> None :
@@ -414,7 +421,7 @@ def _add_local_dependencies(
414421 yaml = yaml ,
415422 verbose = verbose ,
416423 is_nested = True ,
417- origin = path_with_extras . path ,
424+ origin = path_with_extras ,
418425 )
419426
420427
@@ -455,7 +462,7 @@ def parse_requirements(
455462 # `data` and `all_extras` are lists of the same length
456463 datas : list [dict [str , Any ]] = []
457464 all_extras : list [list [str ]] = []
458- seen : set [PathWithExtras ] = set ()
465+ seen : set [tuple [ PathWithExtras , ...] ] = set ()
459466 yaml = YAML (typ = "rt" ) # Might be unused if all are TOML files
460467 for path_with_extras in paths_with_extras :
461468 _update_data_structures (
0 commit comments