@@ -548,6 +548,153 @@ def test_get_deps_requirements_multi_location_scenario(tmp_path):
548548 )
549549
550550
551+ def test_get_deps_requirements_uv_sources_path (tmp_path ):
552+ """Test get_deps_requirements handles [tool.uv.sources] with path (no workspace)."""
553+ python_version = version .Version (f"{ sys .version_info .major } .{ sys .version_info .minor } " )
554+
555+ # Create main package
556+ app_dir = tmp_path / "my-app"
557+ app_dir .mkdir ()
558+ (app_dir / "my_app" ).mkdir ()
559+ (app_dir / "my_app" / "__init__.py" ).write_text ("" )
560+ (app_dir / "pyproject.toml" ).write_text ("""
561+ [project]
562+ name = "my-app"
563+ version = "0.1.0"
564+ dependencies = [
565+ "dagster>=1.0.0",
566+ "dagster-cloud>=1.0.0",
567+ "local-utils",
568+ ]
569+
570+ [tool.uv.sources]
571+ local-utils = { path = "../local-utils" }
572+
573+ [build-system]
574+ requires = ["hatchling"]
575+ build-backend = "hatchling.build"
576+ """ )
577+
578+ # Create local-utils as a sibling package (not a workspace member)
579+ local_utils_dir = tmp_path / "local-utils"
580+ local_utils_dir .mkdir ()
581+ (local_utils_dir / "local_utils" ).mkdir ()
582+ (local_utils_dir / "local_utils" / "__init__.py" ).write_text ("" )
583+ (local_utils_dir / "pyproject.toml" ).write_text ("""
584+ [project]
585+ name = "local-utils"
586+ version = "0.1.0"
587+ dependencies = ["pydantic>=2.0.0"]
588+
589+ [build-system]
590+ requires = ["hatchling"]
591+ build-backend = "hatchling.build"
592+ """ )
593+
594+ # Get deps from the app directory
595+ local_packages , deps_requirements = deps .get_deps_requirements (str (app_dir ), python_version )
596+
597+ deps_lines = [
598+ line .strip ()
599+ for line in deps_requirements .requirements_txt .strip ().split ("\n " )
600+ if line .strip ()
601+ ]
602+
603+ # External deps should be in requirements
604+ assert any ("dagster>=" in dep for dep in deps_lines ), f"dagster not found in { deps_lines } "
605+
606+ # local-utils should be detected as a local package via path source
607+ assert str (local_utils_dir ) in local_packages .local_package_paths , (
608+ f"local-utils should be in local_package_paths: { local_packages .local_package_paths } "
609+ )
610+ assert not any ("local-utils" in dep for dep in deps_lines ), (
611+ f"local-utils should NOT be in deps (it's a local package): { deps_lines } "
612+ )
613+
614+
615+ def test_get_deps_requirements_uv_workspace (tmp_path ):
616+ """Test get_deps_requirements correctly handles uv workspace local dependencies.
617+
618+ When a uv workspace member has dependencies on other workspace members
619+ (via [tool.uv.sources] with workspace = true), those should be detected
620+ as local packages and included in local_package_paths.
621+ """
622+ python_version = version .Version (f"{ sys .version_info .major } .{ sys .version_info .minor } " )
623+
624+ # Create workspace root
625+ workspace_root = tmp_path
626+ (workspace_root / "pyproject.toml" ).write_text ("""
627+ [project]
628+ name = "my-workspace"
629+ version = "0.1.0"
630+
631+ [tool.uv.workspace]
632+ members = ["my-app", "shared-lib"]
633+ """ )
634+
635+ # Create main app package
636+ app_dir = workspace_root / "my-app"
637+ app_dir .mkdir ()
638+ (app_dir / "my_app" ).mkdir ()
639+ (app_dir / "my_app" / "__init__.py" ).write_text ("" )
640+ (app_dir / "pyproject.toml" ).write_text ("""
641+ [project]
642+ name = "my-app"
643+ version = "0.1.0"
644+ dependencies = [
645+ "dagster>=1.0.0",
646+ "dagster-cloud>=1.0.0",
647+ "requests>=2.25.0",
648+ "shared-lib",
649+ ]
650+
651+ [tool.uv.sources]
652+ shared-lib = { workspace = true }
653+
654+ [build-system]
655+ requires = ["hatchling"]
656+ build-backend = "hatchling.build"
657+ """ )
658+
659+ # Create shared-lib workspace member
660+ shared_lib_dir = workspace_root / "shared-lib"
661+ shared_lib_dir .mkdir ()
662+ (shared_lib_dir / "shared_lib" ).mkdir ()
663+ (shared_lib_dir / "shared_lib" / "__init__.py" ).write_text ("" )
664+ (shared_lib_dir / "pyproject.toml" ).write_text ("""
665+ [project]
666+ name = "shared-lib"
667+ version = "0.1.0"
668+ dependencies = ["pydantic>=2.0.0"]
669+
670+ [build-system]
671+ requires = ["hatchling"]
672+ build-backend = "hatchling.build"
673+ """ )
674+
675+ # Get deps from the app directory
676+ local_packages , deps_requirements = deps .get_deps_requirements (str (app_dir ), python_version )
677+
678+ deps_lines = [
679+ line .strip ()
680+ for line in deps_requirements .requirements_txt .strip ().split ("\n " )
681+ if line .strip ()
682+ ]
683+
684+ # External deps should be in requirements
685+ assert any ("dagster>=" in dep for dep in deps_lines ), f"dagster not found in { deps_lines } "
686+ assert any ("requests" in dep for dep in deps_lines ), f"requests not found in { deps_lines } "
687+
688+ # shared-lib is a workspace dependency - it should be detected as a local package
689+ # and NOT appear in the requirements (it would fail pip install)
690+ assert str (shared_lib_dir ) in local_packages .local_package_paths , (
691+ f"shared-lib should be in local_package_paths: { local_packages .local_package_paths } "
692+ )
693+ assert not any ("shared-lib" in dep for dep in deps_lines ), (
694+ f"shared-lib should NOT be in deps (it's a local package): { deps_lines } "
695+ )
696+
697+
551698def test_get_pyproject_deps_requirements_multi_location_scenario () -> None :
552699 """Test scenario that mimics multi-location build with nested packages.
553700
0 commit comments