Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 165 additions & 74 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ toml_edit = "0.22.24"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
typed-path = "0.11.0"
uv-build-frontend = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-distribution-filename = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-distribution-types = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-install-wheel = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-pep440 = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-pep508 = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-platform-tags = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-pypi-types = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-requirements-txt = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-build-frontend = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-distribution-filename = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-distribution-types = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-install-wheel = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-pep440 = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-pep508 = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-platform-tags = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-pypi-types = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-requirements-txt = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }

wax = "0.6.0"
which = "8.0.0"
Expand Down Expand Up @@ -144,23 +144,23 @@ simple_spawn_blocking = { version = "1.1.0", default-features = false }

# Bumping this to a higher version breaks the Windows path handling.
url = "2.5.4"
uv-auth = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-cache = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-cache-info = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-client = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-configuration = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-dispatch = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-distribution = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-git = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-git-types = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-installer = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-normalize = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-python = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-redacted = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-requirements = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-resolver = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-types = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-workspace = { git = "https://github.com/astral-sh/uv", tag = "0.7.20" }
uv-auth = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-cache = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-cache-info = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-client = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-configuration = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-dispatch = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-distribution = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-git = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-git-types = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-installer = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-normalize = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-python = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-redacted = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-requirements = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-resolver = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-types = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
uv-workspace = { git = "https://github.com/astral-sh/uv", tag = "0.8.5" }
winapi = { version = "0.3.9", default-features = false }
xxhash-rust = "0.8.15"
zip = { version = "2.4.2", default-features = false }
Expand Down
6 changes: 5 additions & 1 deletion crates/pixi_uv_conversions/src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ pub fn to_uv_trusted_host(
}

/// Converts a date to a `uv_resolver::ExcludeNewer`
/// since 0.8.2 uv also allows this per package,
/// but we only support the global one for now
pub fn to_exclude_newer(exclude_newer: chrono::DateTime<chrono::Utc>) -> uv_resolver::ExcludeNewer {
let seconds_since_epoch = exclude_newer.timestamp();
let nanoseconds = exclude_newer.timestamp_subsec_nanos();
Expand All @@ -480,5 +482,7 @@ pub fn to_exclude_newer(exclude_newer: chrono::DateTime<chrono::Utc>) -> uv_reso
jiff::Timestamp::MAX
},
);
uv_resolver::ExcludeNewer::from(timestamp)
// Will convert into a global ExcludeNewer
// ..into is needed to convert into the uv timestamp type
uv_resolver::ExcludeNewer::global(timestamp.into())
}
4 changes: 2 additions & 2 deletions crates/pixi_uv_conversions/src/requirements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ pub fn as_uv_req(
if canonicalized.is_dir() {
RequirementSource::Directory {
install_path: canonicalized.into_boxed_path(),
editable: editable.unwrap_or_default(),
editable: Some(editable.unwrap_or_default()),
url: verbatim,
// TODO: we could see if we ever need this
// AFAICS it would be useful for constrainging dependencies
r#virtual: false,
r#virtual: Some(false),
}
} else if *editable == Some(true) {
{
Expand Down
8 changes: 7 additions & 1 deletion src/install_pypi/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ pub fn convert_to_dist(
let pkg_name =
uv_normalize::PackageName::from_str(pkg.name.as_ref()).expect("should be correct");
if abs_path.is_dir() {
Dist::from_directory_url(pkg_name, absolute_url, &abs_path, pkg.editable, false)?
Dist::from_directory_url(
pkg_name,
absolute_url,
&abs_path,
Some(pkg.editable),
Some(false),
)?
} else {
Dist::from_file_url(
pkg_name,
Expand Down
63 changes: 45 additions & 18 deletions src/install_pypi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{collections::HashMap, path::Path, sync::Arc};

use crate::environment::{ContinuePyPIPrefixUpdate, on_python_interpreter_change};
use chrono::{DateTime, Utc};
use conda_pypi_clobber::PypiCondaClobberRegistry;
use fancy_display::FancyDisplay;
use itertools::Itertools;
Expand All @@ -14,6 +15,7 @@ use pixi_progress::await_in_progress;
use pixi_record::PixiRecord;
use pixi_uv_conversions::{
BuildIsolation, locked_indexes_to_index_locations, pypi_options_to_build_options,
to_exclude_newer, to_index_strategy,
};
use plan::{InstallPlanner, InstallReason, NeedReinstall, PyPIInstallationPlan};
use pypi_modifiers::{
Expand All @@ -25,18 +27,19 @@ use rattler_lock::{PypiIndexes, PypiPackageData, PypiPackageEnvironmentData};
use utils::elapsed;
use uv_auth::store_credentials_from_url;
use uv_client::{Connectivity, FlatIndexClient, RegistryClient, RegistryClientBuilder};
use uv_configuration::{BuildOptions, ConfigSettings, Constraints, IndexStrategy, PreviewMode};
use uv_dispatch::{BuildDispatch, SharedState};
use uv_configuration::{
BuildOptions, ConfigSettings, Constraints, IndexStrategy, PackageConfigSettings,
};
use uv_dispatch::BuildDispatch;
use uv_distribution::{BuiltWheelIndex, DistributionDatabase, RegistryWheelIndex};
use uv_distribution_types::{
CachedDist, DependencyMetadata, Dist, IndexLocations, IndexUrl, InstalledDist, Name, Resolution,
CachedDist, DependencyMetadata, Dist, ExtraBuildRequires, IndexLocations, IndexUrl,
InstalledDist, Name, Resolution,
};
use uv_install_wheel::LinkMode;
use uv_installer::{Preparer, SitePackages, UninstallError};
use uv_python::{Interpreter, PythonEnvironment};
use uv_resolver::FlatIndex;
use uv_types::HashStrategy;
use uv_workspace::WorkspaceCache;
use uv_resolver::{ExcludeNewer, FlatIndex};

use crate::{
install_pypi::plan::{CachedWheels, RequiredDists},
Expand Down Expand Up @@ -65,6 +68,8 @@ pub struct PyPIBuildConfig<'a> {
pub no_build_isolation: &'a NoBuildIsolation,
pub no_build: &'a NoBuild,
pub no_binary: &'a NoBinary,
pub index_strategy: Option<&'a pixi_manifest::pypi::pypi_options::IndexStrategy>,
pub exclude_newer: Option<&'a DateTime<Utc>>,
}

/// Configuration for PyPI context, grouping uv and environment settings
Expand All @@ -84,6 +89,10 @@ struct UvInstallerConfig {
config_settings: ConfigSettings,
venv: PythonEnvironment,
build_isolation: BuildIsolation,
constraints: Constraints,
index_strategy: IndexStrategy,
dependency_metadata: DependencyMetadata,
exclude_newer: ExcludeNewer,
}

/// High-level interface for PyPI environment updates that handles all complexity internally
Expand Down Expand Up @@ -251,6 +260,7 @@ impl<'a> PyPIEnvironmentUpdater<'a> {

// Create a Python environment
let venv = PythonEnvironment::from_interpreter(interpreter);
let constraints = Constraints::default();

// Determine isolated packages based on input, converting names.
let build_isolation = self
Expand All @@ -260,6 +270,13 @@ impl<'a> PyPIEnvironmentUpdater<'a> {
.try_into()
.into_diagnostic()?;

let index_strategy = to_index_strategy(self.build_config.index_strategy);
let exclude_newer = self
.build_config
.exclude_newer
.map(|d| to_exclude_newer(*d))
.unwrap_or_default();

Ok(UvInstallerConfig {
tags,
index_locations,
Expand All @@ -269,6 +286,10 @@ impl<'a> PyPIEnvironmentUpdater<'a> {
config_settings,
venv,
build_isolation,
constraints,
index_strategy,
dependency_metadata: DependencyMetadata::default(),
exclude_newer,
})
}

Expand Down Expand Up @@ -299,14 +320,20 @@ impl<'a> PyPIEnvironmentUpdater<'a> {
&self.context_config.uv_context.cache,
&setup.tags,
&setup.index_locations,
&HashStrategy::None,
&self.context_config.uv_context.hash_strategy,
&setup.config_settings,
);
// These were added in 0.8.2, we might want to support these
// if people ask for them
let package_settings = PackageConfigSettings::default();
let extra_build_requires = ExtraBuildRequires::default();
let built_wheel_index = BuiltWheelIndex::new(
&self.context_config.uv_context.cache,
&setup.tags,
&HashStrategy::None,
&self.context_config.uv_context.hash_strategy,
&setup.config_settings,
&package_settings,
&extra_build_requires,
);

// Partition into those that should be linked from the cache (`cached`), those
Expand Down Expand Up @@ -580,8 +607,7 @@ impl<'a> PyPIEnvironmentUpdater<'a> {
.with_starting_tasks(remote.iter().map(|(d, _)| format!("{}", d.name())))
.with_top_level_message("Preparing distributions");

let dependency_metadata = DependencyMetadata::default();
let build_dispatch = self.create_build_dispatch(&dependency_metadata, setup);
let build_dispatch = self.create_build_dispatch(setup);

let distribution_database = DistributionDatabase::new(
setup.registry_client.as_ref(),
Expand Down Expand Up @@ -630,7 +656,6 @@ impl<'a> PyPIEnvironmentUpdater<'a> {

fn create_build_dispatch<'setup>(
&'setup self,
dependency_metadata: &'setup DependencyMetadata,
setup: &'setup UvInstallerConfig,
) -> BuildDispatch<'setup>
where
Expand All @@ -639,23 +664,25 @@ impl<'a> PyPIEnvironmentUpdater<'a> {
BuildDispatch::new(
&setup.registry_client,
&self.context_config.uv_context.cache,
Constraints::default(),
&setup.constraints,
setup.venv.interpreter(),
&setup.index_locations,
&setup.flat_index,
dependency_metadata,
SharedState::default(),
IndexStrategy::default(),
&setup.dependency_metadata,
self.context_config.uv_context.shared_state.fork(),
setup.index_strategy,
&setup.config_settings,
&self.context_config.uv_context.package_config_settings,
setup.build_isolation.to_uv(&setup.venv),
&self.context_config.uv_context.extra_build_requires,
LinkMode::default(),
&setup.build_options,
&self.context_config.uv_context.hash_strategy,
None,
setup.exclude_newer.clone(),
self.context_config.uv_context.source_strategy,
WorkspaceCache::default(),
self.context_config.uv_context.workspace_cache.clone(),
self.context_config.uv_context.concurrency,
PreviewMode::Disabled,
self.context_config.uv_context.preview,
)
// Important: this passes any CONDA activation to the uv build process
.with_build_extra_env_vars(self.context_config.environment_variables.iter())
Expand Down
Loading