Skip to content

fix(shell-hook): honor explicit manifest#4536

Merged
tdejager merged 2 commits intoprefix-dev:mainfrom
remimimimimi:fix/shell-hook-manifest-path
Sep 10, 2025
Merged

fix(shell-hook): honor explicit manifest#4536
tdejager merged 2 commits intoprefix-dev:mainfrom
remimimimimi:fix/shell-hook-manifest-path

Conversation

@remimimimimi
Copy link
Contributor

Should resolve #4149.

Test:

$ mkdir ../test_proj
$ tixi init ../test_proj                     
✔ Created /home/remi/Projects/Mine/test_proj/pixi.toml
$ eval "$(tixi shell-hook --manifest-path ../test_proj)"                              
$ tixi project channel add --manifest-path ../test_proj --prepend bioimageit
✔ Added bioimageit (https://conda.anaconda.org/bioimageit/)
$ tixi add --manifest-path ../test_proj atlas                               
✔ Added atlas >=1.0.2,<2
$ which atlas
/home/remi/Projects/Mine/test_proj/.pixi/envs/default/bin/atlas

@lucascolley lucascolley self-requested a review September 8, 2025 12:44
@lucascolley lucascolley added bug Something isn't working area:shell-hook Related to pixi shell-hook labels Sep 8, 2025
@remimimimimi remimimimimi force-pushed the fix/shell-hook-manifest-path branch from 54ea693 to afa966b Compare September 8, 2025 14:25
Copy link
Collaborator

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix confirmed, nice work @remimimimimi ! What a small diff :)

pixi on 🎋 fix/shell-hook-manifest-path via 🐍 via 🦀 v1.86.0 via 🧚 v0.54.1pixi init --no-progress "/Users/lucascolley/sandbox/pixi4149"
✔ Created /Users/lucascolley/sandbox/pixi4149/pixi.toml

pixi on 🎋 fix/shell-hook-manifest-path via 🐍 via 🦀 v1.86.0 via 🧚 v0.54.1eval "$(pixid shell-hook --manifest-path "/Users/lucascolley/sandbox/pixi4149/pixi.toml")"

pixi on 🎋 fix/shell-hook-manifest-path via 🐍 via 🦀 v1.86.0 via 🧚 v0.54.1 (default)pixid project channel add --manifest-path "/Users/lucascolley/sandbox/pixi4149/pixi.toml"  --prepend bioimageit
✔ Added bioimageit (https://conda.anaconda.org/bioimageit/)

pixi on 🎋 fix/shell-hook-manifest-path via 🐍 via 🦀 v1.86.0 via 🧚 v0.54.1 (default)pixid add --manifest-path "/Users/lucascolley/sandbox/pixi4149/pixi.toml" atlas
✔ Added atlas >=1.0.3,<2

pixi on 🎋 fix/shell-hook-manifest-path via 🐍 via 🦀 v1.86.0 via 🧚 v0.54.1 (default)which atlas
/Users/lucascolley/sandbox/pixi4149/.pixi/envs/default/bin/atlas

@lucascolley
Copy link
Collaborator

Maybe we should add that test case to the test suite before merging?

Copy link
Contributor

tdejager commented Sep 9, 2025

That's always prudent indeed 🙂

@remimimimimi remimimimimi force-pushed the fix/shell-hook-manifest-path branch from a6059ad to 70371db Compare September 9, 2025 08:53
Comment on lines +7 to +20
struct CwdGuard(std::path::PathBuf);
impl CwdGuard {
fn new(new_dir: std::path::PathBuf) -> CwdGuard {
let orig_dir = std::env::current_dir().unwrap();
let guard = CwdGuard(orig_dir);
std::env::set_current_dir(new_dir).unwrap();
guard
}
}
impl Drop for CwdGuard {
fn drop(&mut self) {
let _ = std::env::set_current_dir(&self.0);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just inline this into the code. Also add a comment that tests should not be added to this file to interefere with the cwd setting :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just discussed, so I suppose its either a seperate binary. Using subprocess in the rust test (ugly :P). Or a pytest.

@remimimimimi remimimimimi force-pushed the fix/shell-hook-manifest-path branch from 70371db to 705264c Compare September 9, 2025 11:27
@remimimimimi remimimimimi force-pushed the fix/shell-hook-manifest-path branch from 705264c to 2b7494c Compare September 9, 2025 11:41
@lucascolley lucascolley requested a review from tdejager September 9, 2025 11:49
@tdejager tdejager merged commit a331c4a into prefix-dev:main Sep 10, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:shell-hook Related to pixi shell-hook bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(shell-hook): local manifest used despite --manifest-path argument when another environment is activated

3 participants