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: use new gateway to get the repodata for global install #1767

Merged

Conversation

nichmor
Copy link
Contributor

@nichmor nichmor commented Aug 8, 2024

This PR aims to change pixi global install to use new repodata gateway.

Partially close #1720 ( pixi search and pixi global update should also use it )

@@ -446,6 +447,12 @@ impl From<ConfigCliPrompt> for Config {
}
}

impl From<Config> for rattler_repodata_gateway::ChannelConfig {
fn from(val: Config) -> Self {
from_pixi_config(&val)
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 like from_pixi_config but I decided to use something more rusty for this

@@ -19,3 +22,19 @@ pub fn from_pixi_config(config: &Config) -> ChannelConfig {
per_channel: Default::default(),
}
}

/// Constructs a [`Gateway`] from a [`ClientWithMiddleware`] and a [`Config`]
pub fn new_gateway(client: ClientWithMiddleware, config: Config) -> Gateway {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have a gateway per project, I thought it would be nice to have an API for some more global gateway

@nichmor nichmor marked this pull request as ready for review August 9, 2024 09:08
crates/pixi_config/src/gateway.rs Outdated Show resolved Hide resolved
Comment on lines 450 to 469
#[cfg(feature = "rattler_repodata_gateway")]
impl From<Config> for rattler_repodata_gateway::ChannelConfig {
fn from(config: Config) -> Self {
let default_source_config = config
.repodata_config
.as_ref()
.map(|config| SourceConfig {
jlap_enabled: !config.disable_jlap.unwrap_or(false),
zstd_enabled: !config.disable_zstd.unwrap_or(false),
bz2_enabled: !config.disable_bzip2.unwrap_or(false),
cache_action: Default::default(),
})
.unwrap_or_default();

rattler_repodata_gateway::ChannelConfig {
default: default_source_config,
per_channel: Default::default(),
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a duplicate of the existing from_pixi_config function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot to remove it! I want to keep it's implementation in this trait, so when you need to convert you just
call config.into()
wdyt?

@@ -19,3 +22,19 @@ pub fn from_pixi_config(config: &Config) -> ChannelConfig {
per_channel: Default::default(),
}
}

/// Constructs a [`Gateway`] from a [`ClientWithMiddleware`] and a [`Config`]
pub fn new_gateway(client: ClientWithMiddleware, config: Config) -> Gateway {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this could be a function of Config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@nichmor nichmor requested a review from baszalmstra August 12, 2024 08:30
src/cli/exec.rs Outdated
Comment on lines 158 to 159
.with_client(client.clone())
.with_channel_config(from_pixi_config(config))
.with_channel_config(config.into())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use the gateway function here?

@ruben-arts ruben-arts merged commit decee03 into prefix-dev:main Aug 12, 2024
28 checks passed
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.

Use the new repodata gateway in pixi search
3 participants