Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add menu item install to pixi global #2699

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented Dec 12, 2024

This is an initial implementation.

It will add a menu-install = true to your environments if it installs menu items.

TODO:

  • only add field to toml if it installed menu items

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.

Added a few comments



def test_menuinst_install(pixi: Path, tmp_pixi_workspace: Path, dummy_channel_1: str) -> None:
env = {"PIXI_HOME": str(tmp_pixi_workspace)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to avoid cluttering the machine with things installed by our tests.
For Linux setting HOME should do. Let's check what's the best approach for macOS and Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean to say with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

We solved the confusion

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.

Nice work. I checked the code and left a few comments, but didn't test it locally yet

Serialize::serialize(self, toml_edit::ser::ValueSerializer::new()).unwrap()
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a test for a weird table name? E.g. with a dot inside?
No worries if it doesn't work, but we could open an issue for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea

}

/// Sets the platform for this environment
pub fn with_platform(mut self, platform: Option<Platform>) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn with_platform(mut self, platform: Option<Platform>) -> Self {
pub fn with_platform(mut self, platform: Platform) -> Self {

You wouldn't call this method if it were None

}

/// Sets the menu install flag for this environment
pub fn with_menu_install(mut self, menu_install: Option<bool>) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn with_menu_install(mut self, menu_install: Option<bool>) -> Self {
pub fn with_menu_install(mut self, menu_install: bool) -> Self {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I felt like the code flow was more readable if the stayed being an option as it does contain information being None vs Some(true) or Some(false)

),
);
}
// Don't fail on menu install errors, menuinst is too unstable to break the whole process because of issue with it.
Copy link
Contributor

Choose a reason for hiding this comment

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

What makes menuinst so unstable that we wouldn't error on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be something we want to test, but as it was a prototype state feature I didn't want to block users with it.

src/prefix.rs Outdated
Comment on lines 81 to 82
let entry = entry.into_diagnostic()?;
let path = entry.path();
Copy link
Contributor

Choose a reason for hiding this comment

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

Move those two line into one line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants