@@ -8,7 +8,8 @@ use typed_path::Utf8TypedPath;
88use crate :: common:: pypi_index:: { Database as PyPIDatabase , PyPIPackage } ;
99use crate :: common:: { LockFileExt , PixiControl } ;
1010use crate :: setup_tracing;
11- use pixi_test_utils:: { MockRepoData , Package } ;
11+ use pixi_consts:: consts;
12+ use pixi_test_utils:: { GitRepoFixture , MockRepoData , Package } ;
1213
1314/// Helper to check if a pypi package is installed as editable by looking for a .pth file.
1415/// Editable installations create a .pth file in site-packages that points to the source directory.
@@ -1460,3 +1461,109 @@ version = "0.1.0"
14601461 "Package should NOT be installed as editable when manifest doesn't specify editable = true (even if lock file has editable: true)"
14611462 ) ;
14621463}
1464+
1465+ #[ tokio:: test]
1466+ async fn test_no_deps_git_skips_transitive_dependencies ( ) {
1467+ setup_tracing ( ) ;
1468+
1469+ let platform = Platform :: current ( ) ;
1470+
1471+ let mut package_db = MockRepoData :: default ( ) ;
1472+ package_db. add_package (
1473+ Package :: build ( "python" , "3.12.0" )
1474+ . with_subdir ( platform)
1475+ . finish ( ) ,
1476+ ) ;
1477+ let channel = package_db. into_channel ( ) . await . unwrap ( ) ;
1478+
1479+ let pypi_index = PyPIDatabase :: new ( )
1480+ . with ( PyPIPackage :: new ( "dep" , "1.0.0" ) )
1481+ . into_simple_index ( )
1482+ . unwrap ( ) ;
1483+
1484+ let git_fixture = GitRepoFixture :: new ( "pypi-deps-package" ) ;
1485+
1486+ let pixi = PixiControl :: from_manifest ( & format ! (
1487+ r#"
1488+ [workspace]
1489+ name = "pypi-no-deps-git"
1490+ platforms = ["{platform}"]
1491+ channels = ["{channel}"]
1492+ conda-pypi-map = {{}}
1493+
1494+ [dependencies]
1495+ python = "==3.12.0"
1496+
1497+ [pypi-dependencies]
1498+ deps-package = {{ git = "{git_url}", no-deps = true }}
1499+
1500+ [pypi-options]
1501+ extra-index-urls = ["{index_url}"]
1502+ "# ,
1503+ platform = platform,
1504+ channel = channel. url( ) ,
1505+ git_url = git_fixture. url,
1506+ index_url = pypi_index. index_url( ) ,
1507+ ) ) ;
1508+
1509+ let lock_file = pixi. unwrap ( ) . update_lock_file ( ) . await . unwrap ( ) ;
1510+
1511+ assert ! ( lock_file. contains_pypi_package(
1512+ consts:: DEFAULT_ENVIRONMENT_NAME ,
1513+ platform,
1514+ "deps-package"
1515+ ) ) ;
1516+ assert ! ( !lock_file. contains_pypi_package( consts:: DEFAULT_ENVIRONMENT_NAME , platform, "dep" ) ) ;
1517+ }
1518+
1519+ #[ tokio:: test]
1520+ async fn test_no_deps_path_skips_transitive_dependencies ( ) {
1521+ setup_tracing ( ) ;
1522+
1523+ let platform = Platform :: current ( ) ;
1524+
1525+ let mut package_db = MockRepoData :: default ( ) ;
1526+ package_db. add_package (
1527+ Package :: build ( "python" , "3.12.0" )
1528+ . with_subdir ( platform)
1529+ . finish ( ) ,
1530+ ) ;
1531+ let channel = package_db. into_channel ( ) . await . unwrap ( ) ;
1532+
1533+ let index = PyPIDatabase :: new ( )
1534+ . with ( PyPIPackage :: new ( "pathpkg" , "1.0.0" ) . with_requires_dist ( [ "dep>=1.0.0" ] ) )
1535+ . with ( PyPIPackage :: new ( "dep" , "1.0.0" ) )
1536+ . into_flat_index ( )
1537+ . expect ( "failed to create local flat index" ) ;
1538+
1539+ let wheel_path = index
1540+ . path ( )
1541+ . join ( "pathpkg-1.0.0-py3-none-any.whl" )
1542+ . display ( )
1543+ . to_string ( )
1544+ . replace ( '\\' , "/" ) ;
1545+
1546+ let pixi = PixiControl :: from_manifest ( & format ! (
1547+ r#"
1548+ [workspace]
1549+ name = "pypi-no-deps-path"
1550+ platforms = ["{platform}"]
1551+ channels = ["{channel}"]
1552+ conda-pypi-map = {{}}
1553+
1554+ [dependencies]
1555+ python = "==3.12.0"
1556+
1557+ [pypi-dependencies]
1558+ pathpkg = {{ path = "{wheel_path}", no-deps = true }}
1559+ "# ,
1560+ platform = platform,
1561+ channel = channel. url( ) ,
1562+ wheel_path = wheel_path,
1563+ ) ) ;
1564+
1565+ let lock_file = pixi. unwrap ( ) . update_lock_file ( ) . await . unwrap ( ) ;
1566+
1567+ assert ! ( lock_file. contains_pypi_package( consts:: DEFAULT_ENVIRONMENT_NAME , platform, "pathpkg" ) ) ;
1568+ assert ! ( !lock_file. contains_pypi_package( consts:: DEFAULT_ENVIRONMENT_NAME , platform, "dep" ) ) ;
1569+ }
0 commit comments