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 pixi global expose command #2030

Open
wants to merge 31 commits into
base: feature/pixi-global
Choose a base branch
from

Conversation

nichmor
Copy link
Contributor

@nichmor nichmor commented Sep 10, 2024

Some missing things:

  • : public doc strings
  • : tests
  • : better errors
  • : running pixi global sync at the end

it is also should be merged after #1975 lands first

@Hofer-Julian Hofer-Julian changed the title Feat/add pixi global expose command feat: add pixi global expose command Sep 13, 2024
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.

First, quick review.
Will continue with the rest of the code later

src/cli/global/expose.rs Outdated Show resolved Hide resolved
src/cli/global/expose.rs Outdated Show resolved Hide resolved
src/cli/global/expose.rs Outdated Show resolved Hide resolved
@ruben-arts ruben-arts added this to the New `pixi global` milestone Sep 19, 2024
src/global/install.rs Outdated Show resolved Hide resolved
@Hofer-Julian Hofer-Julian marked this pull request as ready for review September 24, 2024 08:58
Comment on lines +60 to +74
pub fn add_exposed_mapping(
&mut self,
env_name: &EnvironmentName,
mapping: &Mapping,
) -> miette::Result<()> {
self.document
.get_or_insert_nested_table(&format!("envs.{env_name}.exposed"))?
.insert(
&mapping.exposed_name.to_string(),
Item::Value(toml_edit::Value::from(mapping.executable_name.clone())),
);

tracing::debug!("Added exposed mapping {mapping} to toml document");
Ok(())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This function brings this object in an inconsistent state where the TOML is updated but the parsed value is not. I consider this bad practice because after this operation is performed it is unclear whether a next operation will use the updated values or not.

We talked about it being ok to use this approach but I think in that case it should also be reflected in the types. For example by converting this type into a TomlManifest (dropping the parsed) and only adding this method on the self.document type.

@@ -373,23 +389,29 @@ mod tests {
python = "python"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this simple manifest to point to a local channel? That way the tests will be significantly faster.

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.

4 participants