prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.97k stars 163 forks source link

Support Recursive Optional Dependencies #2024

Open tokoko opened 1 week ago

tokoko commented 1 week ago

Problem description

We're migrating to pyproject.toml and plan to switch to using recursive optional dependencies similar to what's described here. Seems like uv handles such dependencies correctly (during during compile and sync), but pixi update basically ignores additional extras when constructing a lock file. An example here.

tdejager commented 1 week ago

cc @baszalmstra as you've been the pixi update frontrunner :)

ruben-arts commented 2 days ago

@tokoko Are you able to create a minimal reproducer?

tokoko commented 1 day ago

@ruben-arts sure, I tested with the following just now:

[project]
name = "example"

[project.optional-dependencies]
np = [
  "numpy",
]

all = [
    "example[np]"
]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]

[tool.pixi.environments]
np = {features = ["np"]}
all = {features = ["all"]}

I'm able to run pixi run -e np python -c "import numpy" just fine, but when I try pixi run -e all python -c "import numpy" I'm getting No module named 'numpy' error.

Here's the output from uv compile command (uv pip compile --extra all pyproject.toml):

# This file was autogenerated by uv via the following command:
#    uv pip compile --extra all pyproject.toml
numpy==2.0.2
    # via example (pyproject.toml)

Hope this helps

ruben-arts commented 1 day ago

Thank you, I would like to ask @tdejager for his input as this is a use-case I'm not sure we have tried to support yet.