-
Notifications
You must be signed in to change notification settings - Fork 493
perf: Making UV the default installer, unless specified explicitly #5733
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
Open
suleman1412
wants to merge
9
commits into
prefix-dev:main
Choose a base branch
from
suleman1412:uv-default-installer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
09e2b7e
making uv the default installer option
suleman1412 4ce7935
installer to be specified via config file
suleman1412 5ca427e
adding installer field to config, and adding necessary impl
suleman1412 e6959d9
adding unit tests for installer field
suleman1412 4436ef6
uv default unless explicitly specified otherwise
suleman1412 01978f7
test refactor
suleman1412 d0c0688
update snapshots to check uv instead of pip
suleman1412 c6e2e60
added tests, modified helper fn to be more flexible
suleman1412 b5c30fa
lininting and removed red test
suleman1412 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| use crate::build_script::Installer; | ||
| use indexmap::IndexMap; | ||
| use pixi_build_backend::generated_recipe::BackendConfig; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
@@ -39,6 +40,13 @@ pub struct PythonBackendConfig { | |
| /// Only meaningful for packages with compiled extensions (non-noarch). | ||
| #[serde(default)] | ||
| pub abi3: Option<bool>, | ||
|
|
||
| /// The package installer to use for building. | ||
| /// Defaults to `uv` (recommended). Use `pip` only when needed for | ||
| /// compatibility with packages that require pip-specific behavior. | ||
| /// Supported values: `"uv"` (default), `"pip"` | ||
| #[serde(default)] | ||
| pub installer: Option<Installer>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont see why we need this. Lets just keepnthe behavior where this is derived |
||
| } | ||
|
|
||
| impl PythonBackendConfig { | ||
|
|
@@ -56,9 +64,10 @@ impl PythonBackendConfig { | |
| /// Creates a new [`PythonBackendConfig`] with default values and | ||
| /// `ignore_pyproject_manifest` set to `true`. | ||
| #[cfg(test)] | ||
| pub fn default_with_ignore_pyproject_manifest() -> Self { | ||
| pub fn default_with_ignore_pyproject_manifest(installer: Option<Installer>) -> Self { | ||
| Self { | ||
| ignore_pyproject_manifest: Some(true), | ||
| installer, | ||
| ..Default::default() | ||
| } | ||
| } | ||
|
|
@@ -110,12 +119,16 @@ impl BackendConfig for PythonBackendConfig { | |
| .ignore_pypi_mapping | ||
| .or(self.ignore_pypi_mapping), | ||
| abi3: target_config.abi3.or(self.abi3), | ||
| installer: target_config.installer.clone().or(self.installer.clone()), | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
|
|
||
| use crate::build_script::Installer; | ||
|
|
||
| use super::PythonBackendConfig; | ||
| use pixi_build_backend::generated_recipe::BackendConfig; | ||
| use serde_json::json; | ||
|
|
@@ -143,6 +156,7 @@ mod tests { | |
| ignore_pyproject_manifest: Some(true), | ||
| ignore_pypi_mapping: Some(true), | ||
| abi3: Some(true), | ||
| installer: None, | ||
| }; | ||
|
|
||
| let mut target_env = indexmap::IndexMap::new(); | ||
|
|
@@ -159,6 +173,7 @@ mod tests { | |
| ignore_pyproject_manifest: Some(false), | ||
| ignore_pypi_mapping: Some(false), | ||
| abi3: Some(false), | ||
| installer: None, | ||
| }; | ||
|
|
||
| let merged = base_config | ||
|
|
@@ -213,6 +228,7 @@ mod tests { | |
| ignore_pyproject_manifest: Some(true), | ||
| ignore_pypi_mapping: Some(true), | ||
| abi3: None, | ||
| installer: None, | ||
| }; | ||
|
|
||
| let empty_target_config = PythonBackendConfig::default(); | ||
|
|
@@ -348,4 +364,19 @@ mod tests { | |
| let error_msg = result.unwrap_err().to_string(); | ||
| assert!(error_msg.contains("`debug_dir` cannot have a target specific value")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_deserialize_installer_field() { | ||
| let json_data = json!({"installer": "uv"}); | ||
| let config: PythonBackendConfig = serde_json::from_value(json_data).unwrap(); | ||
| assert_eq!(config.installer, Some(Installer::Uv)); | ||
|
|
||
| let json_data = json!({"installer": "pip"}); | ||
| let config: PythonBackendConfig = serde_json::from_value(json_data).unwrap(); | ||
| assert_eq!(config.installer, Some(Installer::Pip)); | ||
|
|
||
| let json_data = json!({}); | ||
| let config: PythonBackendConfig = serde_json::from_value(json_data).unwrap(); | ||
| assert_eq!(config.installer, None); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ build: | |
| requirements: | ||
| build: [] | ||
| host: | ||
| - pip | ||
| - uv | ||
| - python | ||
| run: | ||
| - boltons | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ requirements: | |
| build: [] | ||
| host: | ||
| - python | ||
| - pip | ||
| - uv | ||
| run: | ||
| - boltons | ||
| - python | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why remove? Cant we check if an installer is set based on the dependencies and use that, otherwise use the default?