-
Notifications
You must be signed in to change notification settings - Fork 166
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
base: feature/pixi-global
Are you sure you want to change the base?
feat: add pixi global expose command #2030
Conversation
…com/nichmor/pixi into feat/add-pixi-global-expose-command
There was a problem hiding this 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
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(()) | ||
} |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
Some missing things:
it is also should be merged after #1975 lands first