Bring the `exposed` keyword to non-global manifests and pyproject.toml
Problem description
The global manifest provides control on what tools are exposed (i.e. made available on $PATH).
It's documented only for the global manifest, but I tried it like so in a pyproject.toml.
[tool.pixi.environments.default]
features = ["dev"]
exposed = {}
Sadly, pixi install returned Error: Unexpected keys, expected only 'features', 'solve-group', 'no-default-feature'.
Proposed solution
If exposed was available here, and had the same behavior that it does in the global manifest, it would solve a problem I have with project environments. There are some packages that provide both a library and a tool, and I only want the library in my environment. But I get the tool anyway, and it ends up masking a globally installed tool I want to use.
Could you please elaborate on
But I get the tool anyway, and it ends up masking a globally installed tool I want to use.
Does this happen after you activate the env ( either pixi shell / pixi run? )
Does this happen after you activate the env ( either pixi shell / pixi run? )
Yes, exactly. For example, pixi run which dvc finds ./.pixi/envs/default/bin/dvc rather than the globally available dvc. The DVC package has a dvc.api library but also provides the dvc tool. When using it as a tool though, I need to use the globally installed tool, because the global install included extras.
I think we should make this configurable, I do wonder on the entire pixi-manifest level or per feature.
I like this idea! While being at it, a flag such as "suppressed" could make the negation and this example easier, couldn't it?
I could see "suppressed" being useful, but more often I am surprised by tools that show up and would be playing whack-a-mole. For instance, installing hatch provides uv ... I would not normally think to suppress from a dependency.
I'm afraid I don't understand what @nichmor is wondering. I would like each and every environment to have its own configuration for what is exposed.
Im not entirely sure how we can achieve this. Packages simply install whatever into the binary directory. When you invoke something in the environment the PATH variable will first include the path from the bin folder in the environment.
expose in global is different because we generate entry-points in the ~/.pixi/bin folder.
Oh, I didn't consider that the global installs had additional flexibility of adding (or not) to ~/.pixi/bin. This might have to wait for astral-sh/uv#10966.
Im closing this because Im not sure what the ask is. Packages installed in an environment already expose all their binaries. They simply install them into a certain location in the environment. When activating an environment through pixi run, pixi shell and friends those simply get added to the path.
But maybe I misunderstand the ask. Feel free to reopen if I misunderstood.
That's fine. I can understand that implementation of this idea is not likely to be on pixi, but rather on the installer (i.e. pip or uv).