Skip to content

feat: add support for PIXI_ENVIRONMENT_NAME and PS1 prompt modification#4101

Merged
Hofer-Julian merged 27 commits intoprefix-dev:mainfrom
zelosleone:ps1
Aug 11, 2025
Merged

feat: add support for PIXI_ENVIRONMENT_NAME and PS1 prompt modification#4101
Hofer-Julian merged 27 commits intoprefix-dev:mainfrom
zelosleone:ps1

Conversation

@zelosleone
Copy link
Contributor

closes #3999

hopefully tests are enough, i also tested manually and things seemed to pass correctly. though we cannot use the specs flag with multiple packages due to clap. on that note we could set the disable flag to include disabling specs as well but i will leave it open for that.

but now we correctly set env variables alongside with ps1 prompt with packages via specs. there is also a flag now that is used to disable this. default behavior is true and env and ps1 prompt is set by default.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Thanks!

executor.submit(
verify_cli_command,
[pixi, "exec", "-c", dummy_channel_1, "dummy-f"],
[pixi, "exec", "-c", dummy_channel_1, "--", "dummy-f"],
Copy link
Contributor

Choose a reason for hiding this comment

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

The feature is not important to introduce a breaking change in our CLI.

I don't really understand though why this change is necessary, can you explain the problem to me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On my windows machine + github ci it wouldn't pass before i added the seperator between the flags for command, i think it was because of clap's own problem. But then again that was when the backend was down and it was giving multiple errors that could be unrelated to it (though that change solved at least 2 test errors that is related to my pr, again due to clap's own problems)

But now, since i also added default feature being false to clap and made new bool flag for clap to read-process the entire thing, maybe i can try without these changes.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

I don't really understand why you had to change so much code for this.

In my mind, all you have to do is to set two environment variable and add an extra flag.

Is this really not possible with fewer code changes?

@zelosleone
Copy link
Contributor Author

I don't really understand why you had to change so much code for this.

In my mind, all you have to do is to set two environment variable and add an extra flag.

Is this really not possible with fewer code changes?

It gave me multiple errors with the existing code and just a few env variables and a flag such as:

  • --with flag usage would cause the package specs to be confused with system commands when there is no package involved
  • Windows command errors where ps1 env was not recognized without the special cmd logic for windows

But ultimately it was the --with flag that made me write more code on this and made me spent a lot of time on this, i was having an incredibly weird time with that flag combined with specs names.

@zelosleone zelosleone requested a review from Hofer-Julian July 10, 2025 13:49

activation_env.insert("PIXI_ENVIRONMENT_NAME".into(), env_name.clone());

if !args.no_modify_ps1 && std::env::current_dir().is_ok() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it important that there is a current_dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Purely to prevent an UX issue that would give broken prompts (supposing the directory is in temp or gets deleted etc. during running and cmd giving errors for that.) I think its pretty low-cost as well but i can remove it if you want

@zelosleone zelosleone requested a review from baszalmstra July 14, 2025 13:15
@lucascolley lucascolley added area:exec Related to pixi exec enhancement New features labels Jul 21, 2025
Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

A few minor comments, let's bring it in afterwards!

zelosleone and others added 3 commits July 31, 2025 11:51
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
@zelosleone
Copy link
Contributor Author

zelosleone commented Aug 8, 2025

@Hofer-Julian last comment is also addressed! Failing test is due to a timeout.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Great work @zelosleone

@Hofer-Julian Hofer-Julian merged commit 5942eee into prefix-dev:main Aug 11, 2025
41 checks passed
@zelosleone zelosleone deleted the ps1 branch August 11, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:exec Related to pixi exec enhancement New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set PIXI_ENVIRONMENT_NAME to temp:<list-of-specs> on pixi exec

4 participants