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 --priority arg to project channel add #2086

Merged
merged 10 commits into from
Sep 23, 2024

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Sep 19, 2024

  • allows specifying priority
  • fixes project channel remove when priority is present in channels, which errored before.

Draft because this is my first ever Rust PR, and I assume there must be a better way to turn a toml Value into a PrioritizedChannel than what I've done here. I'd love a pointer for the right way to do Value->PrioritizedChannel.

closes #2035

- allows specifying priority
- fixes `channel remove` when priority is present in channels
@minrk minrk changed the title add --priority arg to project channel add feat: add --priority arg to project channel add Sep 19, 2024
always recreate the list rather than parse, edit, unparse
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Thanks you!

This looks good. I would like to move the serialization code to the PrioritizedChannel code.

Also could you add some tests to verify that the channel priority is correctly added. This can be done in the pixi_manifest/src/manifests/manifest.rs. There should be some tests you could mimic.

Comment on lines 574 to 577
let mut table = Table::new().into_inline_table();
table.insert("channel", channel.channel.to_string().into());
table.insert("priority", i64::from(priority).into());
push(table.into());
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of you could implement the toml_edit::Value for this PrioritizedChannel. Which then might be reused in different places.

@minrk minrk marked this pull request as ready for review September 21, 2024 07:35
@minrk
Copy link
Contributor Author

minrk commented Sep 21, 2024

Moved the serialization, did my best to add tests. There didn't appear to be any tests for project channel remove yet.

Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Awesome work! I've added some small nitpicks but nice work on the test! Looks good to me! Great work on your first Rust PR!

@ruben-arts ruben-arts enabled auto-merge (squash) September 23, 2024 09:06
@ruben-arts
Copy link
Contributor

Test fail because of a non related issue!

@ruben-arts ruben-arts merged commit 6cf9218 into prefix-dev:main Sep 23, 2024
16 checks passed
@minrk minrk deleted the add-channel-priority branch September 24, 2024 21:23
@minrk
Copy link
Contributor Author

minrk commented Sep 24, 2024

Thanks for merging and thanks for the help!

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.

allow specifying priority in pixi project channel add
2 participants