diff --git a/src/install_pypi/plan/planner.rs b/src/install_pypi/plan/planner.rs index f932add932..0704127fe3 100644 --- a/src/install_pypi/plan/planner.rs +++ b/src/install_pypi/plan/planner.rs @@ -119,6 +119,7 @@ impl InstallPlanner { let installer = dist .installer() .map_or(String::new(), |f| f.unwrap_or_default()); + tracing::error!("{}:{}", dist.name(), installer); match pkg { // Apparently we need this packages @@ -129,6 +130,7 @@ impl InstallPlanner { } // Uninstall unneeded packages None => { + tracing::error!("Pushing: {}", dist.name()); extraneous.push(dist.clone()); } } diff --git a/tests/data/installation-order/.gitattributes b/tests/data/installation-order/.gitattributes new file mode 100644 index 0000000000..887a2c18f0 --- /dev/null +++ b/tests/data/installation-order/.gitattributes @@ -0,0 +1,2 @@ +# SCM syntax highlighting & preventing 3-way merges +pixi.lock merge=binary linguist-language=YAML linguist-generated=true diff --git a/tests/data/installation-order/.gitignore b/tests/data/installation-order/.gitignore new file mode 100644 index 0000000000..740bb7d1ae --- /dev/null +++ b/tests/data/installation-order/.gitignore @@ -0,0 +1,4 @@ + +# pixi environments +.pixi +*.egg-info diff --git a/tests/data/installation-order/foobar/.gitattributes b/tests/data/installation-order/foobar/.gitattributes new file mode 100644 index 0000000000..887a2c18f0 --- /dev/null +++ b/tests/data/installation-order/foobar/.gitattributes @@ -0,0 +1,2 @@ +# SCM syntax highlighting & preventing 3-way merges +pixi.lock merge=binary linguist-language=YAML linguist-generated=true diff --git a/tests/data/installation-order/foobar/.gitignore b/tests/data/installation-order/foobar/.gitignore new file mode 100644 index 0000000000..740bb7d1ae --- /dev/null +++ b/tests/data/installation-order/foobar/.gitignore @@ -0,0 +1,4 @@ + +# pixi environments +.pixi +*.egg-info diff --git a/tests/data/installation-order/foobar/foobar-0.1.0-pyhbf21a9e_0.conda b/tests/data/installation-order/foobar/foobar-0.1.0-pyhbf21a9e_0.conda new file mode 100644 index 0000000000..ed463773ad Binary files /dev/null and b/tests/data/installation-order/foobar/foobar-0.1.0-pyhbf21a9e_0.conda differ diff --git a/tests/data/installation-order/foobar/pixi.lock b/tests/data/installation-order/foobar/pixi.lock new file mode 100644 index 0000000000..487abeb272 --- /dev/null +++ b/tests/data/installation-order/foobar/pixi.lock @@ -0,0 +1,185 @@ +version: 6 +environments: + default: + channels: + - url: https://prefix.dev/conda-forge/ + packages: + osx-arm64: + - conda: https://prefix.dev/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/ca-certificates-2025.1.31-hf0a4a13_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libexpat-2.7.0-h286801f_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libffi-3.4.6-h1da3d7d_1.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/liblzma-5.8.1-h39f12f2_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libmpdec-4.0.0-h99b78c6_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libsqlite-3.49.1-h3f77e49_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/openssl-3.5.0-h81ee809_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/python-3.13.3-h81fe080_100_cp313.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/python_abi-3.13-6_cp313.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/readline-8.2-h1d1bf99_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda + - conda: https://prefix.dev/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda +packages: +- conda: https://prefix.dev/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda + sha256: adfa71f158cbd872a36394c56c3568e6034aa55c623634b37a4836bd036e6b91 + md5: fc6948412dbbbe9a4c9ddbbcfe0a79ab + depends: + - __osx >=11.0 + license: bzip2-1.0.6 + license_family: BSD + purls: [] + size: 122909 + timestamp: 1720974522888 +- conda: https://prefix.dev/conda-forge/osx-arm64/ca-certificates-2025.1.31-hf0a4a13_0.conda + sha256: 7e12816618173fe70f5c638b72adf4bfd4ddabf27794369bb17871c5bb75b9f9 + md5: 3569d6a9141adc64d2fe4797f3289e06 + license: ISC + purls: [] + size: 158425 + timestamp: 1738298167688 +- conda: https://prefix.dev/conda-forge/osx-arm64/libexpat-2.7.0-h286801f_0.conda + sha256: ee550e44765a7bbcb2a0216c063dcd53ac914a7be5386dd0554bd06e6be61840 + md5: 6934bbb74380e045741eb8637641a65b + depends: + - __osx >=11.0 + constrains: + - expat 2.7.0.* + license: MIT + license_family: MIT + purls: [] + size: 65714 + timestamp: 1743431789879 +- conda: https://prefix.dev/conda-forge/osx-arm64/libffi-3.4.6-h1da3d7d_1.conda + sha256: c6a530924a9b14e193ea9adfe92843de2a806d1b7dbfd341546ece9653129e60 + md5: c215a60c2935b517dcda8cad4705734d + depends: + - __osx >=11.0 + license: MIT + license_family: MIT + purls: [] + size: 39839 + timestamp: 1743434670405 +- conda: https://prefix.dev/conda-forge/osx-arm64/liblzma-5.8.1-h39f12f2_0.conda + sha256: 4291dde55ebe9868491dc29716b84ac3de21b8084cbd4d05c9eea79d206b8ab7 + md5: ba24e6f25225fea3d5b6912e2ac562f8 + depends: + - __osx >=11.0 + license: 0BSD + purls: [] + size: 92295 + timestamp: 1743771392206 +- conda: https://prefix.dev/conda-forge/osx-arm64/libmpdec-4.0.0-h99b78c6_0.conda + sha256: f7917de9117d3a5fe12a39e185c7ce424f8d5010a6f97b4333e8a1dcb2889d16 + md5: 7476305c35dd9acef48da8f754eedb40 + depends: + - __osx >=11.0 + license: BSD-2-Clause + license_family: BSD + purls: [] + size: 69263 + timestamp: 1723817629767 +- conda: https://prefix.dev/conda-forge/osx-arm64/libsqlite-3.49.1-h3f77e49_2.conda + sha256: 907a95f73623c343fc14785cbfefcb7a6b4f2bcf9294fcb295c121611c3a590d + md5: 3b1e330d775170ac46dff9a94c253bd0 + depends: + - __osx >=11.0 + - libzlib >=1.3.1,<2.0a0 + license: Unlicense + purls: [] + size: 900188 + timestamp: 1742083865246 +- conda: https://prefix.dev/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda + sha256: ce34669eadaba351cd54910743e6a2261b67009624dbc7daeeafdef93616711b + md5: 369964e85dc26bfe78f41399b366c435 + depends: + - __osx >=11.0 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + purls: [] + size: 46438 + timestamp: 1727963202283 +- conda: https://prefix.dev/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda + sha256: 2827ada40e8d9ca69a153a45f7fd14f32b2ead7045d3bbb5d10964898fe65733 + md5: 068d497125e4bf8a66bf707254fff5ae + depends: + - __osx >=11.0 + license: X11 AND BSD-3-Clause + purls: [] + size: 797030 + timestamp: 1738196177597 +- conda: https://prefix.dev/conda-forge/osx-arm64/openssl-3.5.0-h81ee809_0.conda + sha256: 53f825acb8d3e13bdad5c869f6dc7df931941450eea7f6473b955b0aaea1a399 + md5: 3d2936da7e240d24c656138e07fa2502 + depends: + - __osx >=11.0 + - ca-certificates + license: Apache-2.0 + license_family: Apache + purls: [] + size: 3067649 + timestamp: 1744132084304 +- conda: https://prefix.dev/conda-forge/osx-arm64/python-3.13.3-h81fe080_100_cp313.conda + build_number: 100 + sha256: fb56abb98af7bc9c6e75f31670264a5755fe2dc86dbae1cb24c134687aa4f6d3 + md5: 76edefc8cc4f2efb3737ccb75e66084e + depends: + - __osx >=11.0 + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.0,<3.0a0 + - libffi >=3.4.6,<3.5.0a0 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.49.1,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.0,<4.0a0 + - python_abi 3.13.* *_cp313 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + license: Python-2.0 + purls: [] + size: 12896905 + timestamp: 1744324106761 + python_site_packages_path: lib/python3.13/site-packages +- conda: https://prefix.dev/conda-forge/osx-arm64/python_abi-3.13-6_cp313.conda + build_number: 6 + sha256: 2f5205eba4d65bb6cb09c2f12c69e8981514222d5aee01b59d5610af9dc6917c + md5: c75e7f94ab431acc3942cc93b8ca6f8d + constrains: + - python 3.13.* *_cp313 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 6972 + timestamp: 1743483253239 +- conda: https://prefix.dev/conda-forge/osx-arm64/readline-8.2-h1d1bf99_2.conda + sha256: 7db04684d3904f6151eff8673270922d31da1eea7fa73254d01c437f49702e34 + md5: 63ef3f6e6d6d5c589e64f11263dc5676 + depends: + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + purls: [] + size: 252359 + timestamp: 1740379663071 +- conda: https://prefix.dev/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda + sha256: 72457ad031b4c048e5891f3f6cb27a53cb479db68a52d965f796910e71a403a8 + md5: b50a57ba89c32b62428b71a875291c9b + depends: + - libzlib >=1.2.13,<2.0.0a0 + license: TCL + license_family: BSD + purls: [] + size: 3145523 + timestamp: 1699202432999 +- conda: https://prefix.dev/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + sha256: 5aaa366385d716557e365f0a4e9c3fca43ba196872abbbe3d56bb610d131e192 + md5: 4222072737ccff51314b5ece9c7d6f5a + license: LicenseRef-Public-Domain + purls: [] + size: 122968 + timestamp: 1742727099393 diff --git a/tests/data/installation-order/foobar/pyproject.toml b/tests/data/installation-order/foobar/pyproject.toml new file mode 100644 index 0000000000..86320cbb1c --- /dev/null +++ b/tests/data/installation-order/foobar/pyproject.toml @@ -0,0 +1,26 @@ +# Run `pixi build` to regenerate the conda file if needed +[project] +authors = [{ name = "Tim de Jager", email = "tim@prefix.dev" }] +dependencies = [] +name = "foobar" +requires-python = ">= 3.11" +version = "0.1.0" + +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + +[tool.pixi.workspace] +channels = ["https://prefix.dev/conda-forge"] +platforms = ["osx-arm64"] +preview = ["pixi-build"] + +[tool.pixi.package] +name = "foobar" +version = "0.1.0" + +[tool.pixi.package.build] +backend = { name = "pixi-build-python", version = "0.1.*" } + +[tool.pixi.package.host-dependencies] +hatchling = "==1.26.3" diff --git a/tests/data/installation-order/foobar/src/foobar/__init__.py b/tests/data/installation-order/foobar/src/foobar/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/installation-order/foobar/src/foobar/a.py b/tests/data/installation-order/foobar/src/foobar/a.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/installation-order/foobar/src/foobar/b.py b/tests/data/installation-order/foobar/src/foobar/b.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/installation-order/foobar_whl/.gitattributes b/tests/data/installation-order/foobar_whl/.gitattributes new file mode 100644 index 0000000000..887a2c18f0 --- /dev/null +++ b/tests/data/installation-order/foobar_whl/.gitattributes @@ -0,0 +1,2 @@ +# SCM syntax highlighting & preventing 3-way merges +pixi.lock merge=binary linguist-language=YAML linguist-generated=true diff --git a/tests/data/installation-order/foobar_whl/.gitignore b/tests/data/installation-order/foobar_whl/.gitignore new file mode 100644 index 0000000000..740bb7d1ae --- /dev/null +++ b/tests/data/installation-order/foobar_whl/.gitignore @@ -0,0 +1,4 @@ + +# pixi environments +.pixi +*.egg-info diff --git a/tests/data/installation-order/foobar_whl/dist/foobar-0.1.1-py3-none-any.whl b/tests/data/installation-order/foobar_whl/dist/foobar-0.1.1-py3-none-any.whl new file mode 100644 index 0000000000..b325f9a4a3 Binary files /dev/null and b/tests/data/installation-order/foobar_whl/dist/foobar-0.1.1-py3-none-any.whl differ diff --git a/tests/data/installation-order/foobar_whl/pixi.lock b/tests/data/installation-order/foobar_whl/pixi.lock new file mode 100644 index 0000000000..d71591150c --- /dev/null +++ b/tests/data/installation-order/foobar_whl/pixi.lock @@ -0,0 +1,192 @@ +version: 6 +environments: + default: + channels: + - url: https://prefix.dev/conda-forge/ + packages: + osx-arm64: + - conda: https://prefix.dev/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/ca-certificates-2025.1.31-hf0a4a13_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libcxx-20.1.2-ha82da77_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libexpat-2.7.0-h286801f_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libffi-3.4.6-h1da3d7d_1.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/liblzma-5.8.1-h39f12f2_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libmpdec-4.0.0-h99b78c6_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libsqlite-3.49.1-h3f77e49_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/openssl-3.5.0-h81ee809_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/python-3.13.3-h81fe080_100_cp313.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/python_abi-3.13-6_cp313.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/readline-8.2-h1d1bf99_2.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda + - conda: https://prefix.dev/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + - conda: https://prefix.dev/conda-forge/osx-arm64/uv-0.6.14-h668ec48_0.conda +packages: +- conda: https://prefix.dev/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda + sha256: adfa71f158cbd872a36394c56c3568e6034aa55c623634b37a4836bd036e6b91 + md5: fc6948412dbbbe9a4c9ddbbcfe0a79ab + depends: + - __osx >=11.0 + license: bzip2-1.0.6 + license_family: BSD + size: 122909 + timestamp: 1720974522888 +- conda: https://prefix.dev/conda-forge/osx-arm64/ca-certificates-2025.1.31-hf0a4a13_0.conda + sha256: 7e12816618173fe70f5c638b72adf4bfd4ddabf27794369bb17871c5bb75b9f9 + md5: 3569d6a9141adc64d2fe4797f3289e06 + license: ISC + size: 158425 + timestamp: 1738298167688 +- conda: https://prefix.dev/conda-forge/osx-arm64/libcxx-20.1.2-ha82da77_0.conda + sha256: e3ad5ba1ff49f988c1476f47f395499e841bdd8eafc3908cb1b64daae3a83f3b + md5: 85ea0d49eb61f57e02ce98dc29ca161f + depends: + - __osx >=11.0 + license: Apache-2.0 WITH LLVM-exception + license_family: Apache + size: 566452 + timestamp: 1743573280445 +- conda: https://prefix.dev/conda-forge/osx-arm64/libexpat-2.7.0-h286801f_0.conda + sha256: ee550e44765a7bbcb2a0216c063dcd53ac914a7be5386dd0554bd06e6be61840 + md5: 6934bbb74380e045741eb8637641a65b + depends: + - __osx >=11.0 + constrains: + - expat 2.7.0.* + license: MIT + license_family: MIT + size: 65714 + timestamp: 1743431789879 +- conda: https://prefix.dev/conda-forge/osx-arm64/libffi-3.4.6-h1da3d7d_1.conda + sha256: c6a530924a9b14e193ea9adfe92843de2a806d1b7dbfd341546ece9653129e60 + md5: c215a60c2935b517dcda8cad4705734d + depends: + - __osx >=11.0 + license: MIT + license_family: MIT + size: 39839 + timestamp: 1743434670405 +- conda: https://prefix.dev/conda-forge/osx-arm64/liblzma-5.8.1-h39f12f2_0.conda + sha256: 4291dde55ebe9868491dc29716b84ac3de21b8084cbd4d05c9eea79d206b8ab7 + md5: ba24e6f25225fea3d5b6912e2ac562f8 + depends: + - __osx >=11.0 + license: 0BSD + size: 92295 + timestamp: 1743771392206 +- conda: https://prefix.dev/conda-forge/osx-arm64/libmpdec-4.0.0-h99b78c6_0.conda + sha256: f7917de9117d3a5fe12a39e185c7ce424f8d5010a6f97b4333e8a1dcb2889d16 + md5: 7476305c35dd9acef48da8f754eedb40 + depends: + - __osx >=11.0 + license: BSD-2-Clause + license_family: BSD + size: 69263 + timestamp: 1723817629767 +- conda: https://prefix.dev/conda-forge/osx-arm64/libsqlite-3.49.1-h3f77e49_2.conda + sha256: 907a95f73623c343fc14785cbfefcb7a6b4f2bcf9294fcb295c121611c3a590d + md5: 3b1e330d775170ac46dff9a94c253bd0 + depends: + - __osx >=11.0 + - libzlib >=1.3.1,<2.0a0 + license: Unlicense + size: 900188 + timestamp: 1742083865246 +- conda: https://prefix.dev/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda + sha256: ce34669eadaba351cd54910743e6a2261b67009624dbc7daeeafdef93616711b + md5: 369964e85dc26bfe78f41399b366c435 + depends: + - __osx >=11.0 + constrains: + - zlib 1.3.1 *_2 + license: Zlib + license_family: Other + size: 46438 + timestamp: 1727963202283 +- conda: https://prefix.dev/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda + sha256: 2827ada40e8d9ca69a153a45f7fd14f32b2ead7045d3bbb5d10964898fe65733 + md5: 068d497125e4bf8a66bf707254fff5ae + depends: + - __osx >=11.0 + license: X11 AND BSD-3-Clause + size: 797030 + timestamp: 1738196177597 +- conda: https://prefix.dev/conda-forge/osx-arm64/openssl-3.5.0-h81ee809_0.conda + sha256: 53f825acb8d3e13bdad5c869f6dc7df931941450eea7f6473b955b0aaea1a399 + md5: 3d2936da7e240d24c656138e07fa2502 + depends: + - __osx >=11.0 + - ca-certificates + license: Apache-2.0 + license_family: Apache + size: 3067649 + timestamp: 1744132084304 +- conda: https://prefix.dev/conda-forge/osx-arm64/python-3.13.3-h81fe080_100_cp313.conda + build_number: 100 + sha256: fb56abb98af7bc9c6e75f31670264a5755fe2dc86dbae1cb24c134687aa4f6d3 + md5: 76edefc8cc4f2efb3737ccb75e66084e + depends: + - __osx >=11.0 + - bzip2 >=1.0.8,<2.0a0 + - libexpat >=2.7.0,<3.0a0 + - libffi >=3.4.6,<3.5.0a0 + - liblzma >=5.8.1,<6.0a0 + - libmpdec >=4.0.0,<5.0a0 + - libsqlite >=3.49.1,<4.0a0 + - libzlib >=1.3.1,<2.0a0 + - ncurses >=6.5,<7.0a0 + - openssl >=3.5.0,<4.0a0 + - python_abi 3.13.* *_cp313 + - readline >=8.2,<9.0a0 + - tk >=8.6.13,<8.7.0a0 + - tzdata + license: Python-2.0 + size: 12896905 + timestamp: 1744324106761 + python_site_packages_path: lib/python3.13/site-packages +- conda: https://prefix.dev/conda-forge/osx-arm64/python_abi-3.13-6_cp313.conda + build_number: 6 + sha256: 2f5205eba4d65bb6cb09c2f12c69e8981514222d5aee01b59d5610af9dc6917c + md5: c75e7f94ab431acc3942cc93b8ca6f8d + constrains: + - python 3.13.* *_cp313 + license: BSD-3-Clause + license_family: BSD + size: 6972 + timestamp: 1743483253239 +- conda: https://prefix.dev/conda-forge/osx-arm64/readline-8.2-h1d1bf99_2.conda + sha256: 7db04684d3904f6151eff8673270922d31da1eea7fa73254d01c437f49702e34 + md5: 63ef3f6e6d6d5c589e64f11263dc5676 + depends: + - ncurses >=6.5,<7.0a0 + license: GPL-3.0-only + license_family: GPL + size: 252359 + timestamp: 1740379663071 +- conda: https://prefix.dev/conda-forge/osx-arm64/tk-8.6.13-h5083fa2_1.conda + sha256: 72457ad031b4c048e5891f3f6cb27a53cb479db68a52d965f796910e71a403a8 + md5: b50a57ba89c32b62428b71a875291c9b + depends: + - libzlib >=1.2.13,<2.0.0a0 + license: TCL + license_family: BSD + size: 3145523 + timestamp: 1699202432999 +- conda: https://prefix.dev/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda + sha256: 5aaa366385d716557e365f0a4e9c3fca43ba196872abbbe3d56bb610d131e192 + md5: 4222072737ccff51314b5ece9c7d6f5a + license: LicenseRef-Public-Domain + size: 122968 + timestamp: 1742727099393 +- conda: https://prefix.dev/conda-forge/osx-arm64/uv-0.6.14-h668ec48_0.conda + sha256: f293883f79901cf96d53e3b7811467941d0b85552a8876b74798a49ee5db76ca + md5: aaad93a044de2358cfa48160b65e785e + depends: + - __osx >=11.0 + - libcxx >=18 + constrains: + - __osx >=11.0 + license: Apache-2.0 OR MIT + size: 10502299 + timestamp: 1744242645977 diff --git a/tests/data/installation-order/foobar_whl/pyproject.toml b/tests/data/installation-order/foobar_whl/pyproject.toml new file mode 100644 index 0000000000..cb701f6c5c --- /dev/null +++ b/tests/data/installation-order/foobar_whl/pyproject.toml @@ -0,0 +1,31 @@ +# run `pixi r wheel` to regenerate the wheel if needed +# remember to remove the sdist afterwards, we do not need it +[project] +authors = [{ name = "Tim de Jager", email = "tim@prefix.dev" }] +dependencies = [] +name = "foobar" +requires-python = ">= 3.11" +version = "0.1.1" + +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + +[tool.hatch.build.targets.wheel] +packages = ["src/foobar_whl"] + +# This is kept in because otherwise the mypy complains about foobar module existing twice +# Which is essentially correct (it exists in foobar as well), so we rename this +[tool.hatch.build.targets.wheel.sources] +"src/foobar_whl" = "foobar" + +[tool.pixi.workspace] +channels = ["https://prefix.dev/conda-forge"] +platforms = ["osx-arm64"] + +[tool.pixi.dependencies] +uv = "==0.6.14" + +[tool.pixi.tasks] +build = "uv build" +wheel = { cmd = "rm .gitignore *.tar.gz", cwd = "dist", depends-on = "build" } diff --git a/tests/data/installation-order/foobar_whl/src/foobar_whl/__init__.py b/tests/data/installation-order/foobar_whl/src/foobar_whl/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/installation-order/foobar_whl/src/foobar_whl/b.py b/tests/data/installation-order/foobar_whl/src/foobar_whl/b.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/installation-order/minimal-0.1.0-py2.py3-none-any.whl b/tests/data/installation-order/minimal-0.1.0-py2.py3-none-any.whl new file mode 100644 index 0000000000..93cec5be7b Binary files /dev/null and b/tests/data/installation-order/minimal-0.1.0-py2.py3-none-any.whl differ diff --git a/tests/data/pixi_tomls/installation-conda-pypi.toml b/tests/data/pixi_tomls/installation-conda-pypi.toml new file mode 100644 index 0000000000..085a6fab25 --- /dev/null +++ b/tests/data/pixi_tomls/installation-conda-pypi.toml @@ -0,0 +1,15 @@ +[workspace] +authors = ["Tim de Jager "] +channels = ["https://prefix.dev/conda-forge"] +name = "installation-order" +platforms = ["osx-arm64"] +version = "0.1.0" + +[tasks] + +[dependencies] +foobar = { path = "./foobar/foobar-0.1.0-pyhbf21a9e_0.conda" } +python = "3.13.*" + +[pypi-dependencies] +minimal = { path = "./minimal-0.1.0-py2.py3-none-any.whl" } diff --git a/tests/data/pixi_tomls/installation-pypi.toml b/tests/data/pixi_tomls/installation-pypi.toml new file mode 100644 index 0000000000..d42af320bc --- /dev/null +++ b/tests/data/pixi_tomls/installation-pypi.toml @@ -0,0 +1,15 @@ +[workspace] +authors = ["Tim de Jager "] +channels = ["https://prefix.dev/conda-forge"] +name = "installation-order" +platforms = ["osx-arm64"] +version = "0.1.0" + +[tasks] + +[dependencies] +python = "3.13.*" + +[pypi-dependencies] +foobar = { path = "./foobar-0.1.1-py3-none-any.whl" } +minimal = { path = "./minimal-0.1.0-py2.py3-none-any.whl" } diff --git a/tests/integration_python/test_edge_cases.py b/tests/integration_python/test_edge_cases.py index cac381d7cf..63eb1e9669 100644 --- a/tests/integration_python/test_edge_cases.py +++ b/tests/integration_python/test_edge_cases.py @@ -346,3 +346,53 @@ def test_build_git_source_deps( stdout_contains="John Doe Jr.", cwd=minimal_workspace, ) + + +def test_installation_pypi_conda_mismatch( + pixi: Path, tmp_pixi_workspace: Path, test_data: Path, pixi_tomls: Path +) -> None: + """ + This tests the following situation, if you have conda and pypi package with the same name, different version, but the same import path. + e.g foobar is the name and the conda package contains files `a.py` and `b.py`, while the pypi package contains just `a.py`. + If you install a lock file with the conda package, then install a lock file with the pypi version, and then subsequently install the conda version again. + The files should be `a.py` and `b.py`. + """ + installation_order = test_data / "installation-order" + pixi_wheel_only = pixi_tomls / "installation-pypi.toml" + pixi_mix = pixi_tomls / "installation-conda-pypi.toml" + dest_toml = tmp_pixi_workspace / "pixi.toml" + + # Copy wheel and conda files + shutil.copyfile( + installation_order / "foobar" / "foobar-0.1.0-pyhbf21a9e_0.conda", + tmp_pixi_workspace / "foobar-0.1.0-pyhbf21a9e_0.conda", + ) + shutil.copyfile( + installation_order / "minimal-0.1.0-py2.py3-none-any.whl", + tmp_pixi_workspace / "minimal-0.1.0-py2.py3-none-any.whl", + ) + shutil.copyfile( + installation_order / "foobar_whl" / "dist" / "foobar-0.1.1-py3-none-any.whl", + tmp_pixi_workspace / "foobar-0.1.1-py3-none-any.whl", + ) + + # First conda + shutil.copyfile(pixi_mix, dest_toml) + verify_cli_command([pixi, "install", "-v"], cwd=tmp_pixi_workspace) + + # Then pypi + shutil.copyfile(pixi_wheel_only, dest_toml) + verify_cli_command([pixi, "install", "-v"], cwd=tmp_pixi_workspace) + + # Then conda again + shutil.copyfile(pixi_mix, dest_toml) + verify_cli_command([pixi, "install", "-vv"], cwd=tmp_pixi_workspace) + + site_packages = ( + tmp_pixi_workspace / ".pixi" / "envs" / "default" / "lib" / "python3.13" / "site-packages" + ) + assert (site_packages / "foobar").exists(), "foobar package does not exist" + # Recall that the conda package contains files `a.py` and `b.py` + assert (site_packages / "foobar" / "a.py").exists(), "a.py does not exist" + # Previously, this file was erroneously removed + assert (site_packages / "foobar" / "b.py").exists(), "b.py does not exist"