pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Bring the `exposed` keyword to non-global manifests and pyproject.toml

Open itcarroll opened this issue 10 months ago • 9 comments

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.

itcarroll avatar Jan 29 '26 14:01 itcarroll

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? )

nichtmacho avatar Jan 29 '26 16:01 nichtmacho

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.

itcarroll avatar Jan 29 '26 18:01 itcarroll

I think we should make this configurable, I do wonder on the entire pixi-manifest level or per feature.

nichtmacho avatar Feb 02 '26 09:02 nichtmacho

I like this idea! While being at it, a flag such as "suppressed" could make the negation and this example easier, couldn't it?

claudiushaag avatar Feb 04 '26 22:02 claudiushaag

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.

itcarroll avatar Feb 04 '26 23:02 itcarroll

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.

baszalmstra avatar Feb 13 '26 10:02 baszalmstra

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.

itcarroll avatar Feb 13 '26 15:02 itcarroll

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.

baszalmstra avatar Apr 17 '26 09:04 baszalmstra

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).

itcarroll avatar Apr 17 '26 11:04 itcarroll