Skip to content

Commit

Permalink
Remove preview labeling for uv 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Aug 19, 2024
1 parent 3eefac4 commit 58d51b0
Show file tree
Hide file tree
Showing 72 changed files with 400 additions and 1,309 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions crates/bench/benches/uv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ mod resolver {
use uv_cache::Cache;
use uv_client::RegistryClient;
use uv_configuration::{
BuildOptions, Concurrency, ConfigSettings, IndexStrategy, PreviewMode, SetupPyStrategy,
SourceStrategy,
BuildOptions, Concurrency, ConfigSettings, IndexStrategy, SetupPyStrategy, SourceStrategy,
};
use uv_dispatch::BuildDispatch;
use uv_distribution::DistributionDatabase;
Expand Down Expand Up @@ -188,7 +187,6 @@ mod resolver {
exclude_newer,
sources,
concurrency,
PreviewMode::Disabled,
);

let markers = if universal {
Expand All @@ -208,12 +206,7 @@ mod resolver {
&hashes,
&build_context,
installed_packages,
DistributionDatabase::new(
client,
&build_context,
concurrency.downloads,
PreviewMode::Disabled,
),
DistributionDatabase::new(client, &build_context, concurrency.downloads),
)?;

Ok(resolver.resolve().await?)
Expand Down
21 changes: 10 additions & 11 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ pub enum Commands {
#[command(flatten)]
Project(Box<ProjectCommand>),

/// Run and install commands provided by Python packages (experimental).
/// Run and install commands provided by Python packages.
#[command(
after_help = "Use `uv help tool` for more details.",
after_long_help = ""
)]
Tool(ToolNamespace),

/// Manage Python versions and installations (experimental)
/// Manage Python versions and installations
///
/// Generally, uv first searches for Python in a virtual environment, either
/// active or in a `.venv` directory in the current working directory or
Expand All @@ -265,8 +265,7 @@ pub enum Commands {
/// On Windows, the `py` launcher is also invoked to find Python
/// executables.
///
/// When preview is enabled, i.e., via `--preview` or by using a preview
/// command, uv will download Python if a version cannot be found. This
/// By default, uv will download Python if a version cannot be found. This
/// behavior can be disabled with the `--python-downloads` option.
///
/// The `--python` option allows requesting a different interpreter.
Expand Down Expand Up @@ -502,7 +501,7 @@ pub enum PipCommand {

#[derive(Subcommand)]
pub enum ProjectCommand {
/// Run a command or script (experimental).
/// Run a command or script.
///
/// Ensures that the command runs in a Python environment.
///
Expand All @@ -529,7 +528,7 @@ pub enum ProjectCommand {
after_long_help = ""
)]
Run(RunArgs),
/// Create a new project (experimental).
/// Create a new project.
///
/// Follows the `pyproject.toml` specification.
///
Expand All @@ -544,7 +543,7 @@ pub enum ProjectCommand {
/// virtual environment (`.venv`) and lockfile (`uv.lock`) are lazily
/// created during the first sync.
Init(InitArgs),
/// Add dependencies to the project (experimental).
/// Add dependencies to the project.
///
/// Dependencies are added to the project's `pyproject.toml` file.
///
Expand All @@ -571,7 +570,7 @@ pub enum ProjectCommand {
after_long_help = ""
)]
Add(AddArgs),
/// Remove dependencies from the project (experimental).
/// Remove dependencies from the project.
///
/// Dependencies are removed from the project's `pyproject.toml` file.
///
Expand All @@ -595,7 +594,7 @@ pub enum ProjectCommand {
after_long_help = ""
)]
Remove(RemoveArgs),
/// Update the project's environment (experimental).
/// Update the project's environment.
///
/// Syncing ensures that all project dependencies are installed and
/// up-to-date with the lockfile. Syncing also removes packages that are not
Expand All @@ -617,7 +616,7 @@ pub enum ProjectCommand {
after_long_help = ""
)]
Sync(SyncArgs),
/// Update the project's lockfile (experimental).
/// Update the project's lockfile.
///
/// If the project lockfile (`uv.lock`) does not exist, it will be created.
/// If a lockfile is present, its contents will be used as preferences for
Expand All @@ -630,7 +629,7 @@ pub enum ProjectCommand {
after_long_help = ""
)]
Lock(LockArgs),
/// Display the project's dependency tree (experimental).
/// Display the project's dependency tree.
Tree(TreeArgs),
}

Expand Down
5 changes: 2 additions & 3 deletions crates/uv-dev/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use uv_build::{SourceBuild, SourceBuildContext};
use uv_cache::{Cache, CacheArgs};
use uv_client::RegistryClientBuilder;
use uv_configuration::{
BuildKind, BuildOptions, Concurrency, ConfigSettings, IndexStrategy, PreviewMode,
SetupPyStrategy, SourceStrategy,
BuildKind, BuildOptions, Concurrency, ConfigSettings, IndexStrategy, SetupPyStrategy,
SourceStrategy,
};
use uv_dispatch::BuildDispatch;
use uv_git::GitResolver;
Expand Down Expand Up @@ -96,7 +96,6 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
exclude_newer,
sources,
concurrency,
PreviewMode::Enabled,
);

let builder = SourceBuild::setup(
Expand Down
19 changes: 3 additions & 16 deletions crates/uv-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use pypi_types::Requirement;
use uv_build::{SourceBuild, SourceBuildContext};
use uv_cache::Cache;
use uv_client::RegistryClient;
use uv_configuration::Concurrency;
use uv_configuration::{
BuildKind, BuildOptions, ConfigSettings, Constraints, IndexStrategy, Reinstall,
SetupPyStrategy, SourceStrategy,
};
use uv_configuration::{Concurrency, PreviewMode};
use uv_distribution::DistributionDatabase;
use uv_git::GitResolver;
use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
Expand Down Expand Up @@ -54,7 +54,6 @@ pub struct BuildDispatch<'a> {
build_extra_env_vars: FxHashMap<OsString, OsString>,
sources: SourceStrategy,
concurrency: Concurrency,
preview_mode: PreviewMode,
}

impl<'a> BuildDispatch<'a> {
Expand All @@ -77,7 +76,6 @@ impl<'a> BuildDispatch<'a> {
exclude_newer: Option<ExcludeNewer>,
sources: SourceStrategy,
concurrency: Concurrency,
preview_mode: PreviewMode,
) -> Self {
Self {
client,
Expand All @@ -100,7 +98,6 @@ impl<'a> BuildDispatch<'a> {
build_extra_env_vars: FxHashMap::default(),
sources,
concurrency,
preview_mode,
}
}

Expand Down Expand Up @@ -162,12 +159,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
&HashStrategy::None,
self,
EmptyInstalledPackages,
DistributionDatabase::new(
self.client,
self,
self.concurrency.downloads,
self.preview_mode,
),
DistributionDatabase::new(self.client, self, self.concurrency.downloads),
)?;
let graph = resolver.resolve().await.with_context(|| {
format!(
Expand Down Expand Up @@ -250,12 +242,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
tags,
&HashStrategy::None,
self.build_options,
DistributionDatabase::new(
self.client,
self,
self.concurrency.downloads,
self.preview_mode,
),
DistributionDatabase::new(self.client, self, self.concurrency.downloads),
);

debug!(
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-distribution/src/distribution_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use uv_cache::{ArchiveId, ArchiveTimestamp, CacheBucket, CacheEntry, Timestamp,
use uv_client::{
CacheControl, CachedClientError, Connectivity, DataWithCachePolicy, RegistryClient,
};
use uv_configuration::PreviewMode;
use uv_extract::hash::Hasher;
use uv_fs::write_atomic;
use uv_types::BuildContext;
Expand Down Expand Up @@ -61,11 +60,10 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
client: &'a RegistryClient,
build_context: &'a Context,
concurrent_downloads: usize,
preview_mode: PreviewMode,
) -> Self {
Self {
build_context,
builder: SourceDistributionBuilder::new(build_context, preview_mode),
builder: SourceDistributionBuilder::new(build_context),
locks: Rc::new(Locks::default()),
client: ManagedClient::new(client, concurrent_downloads),
reporter: None,
Expand Down
11 changes: 0 additions & 11 deletions crates/uv-distribution/src/metadata/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use pep508_rs::{VerbatimUrl, VersionOrUrl};
use pypi_types::{ParsedUrlError, Requirement, RequirementSource, VerbatimParsedUrl};
use thiserror::Error;
use url::Url;
use uv_configuration::PreviewMode;
use uv_fs::{relative_to, Simplified};
use uv_git::GitReference;
use uv_normalize::PackageName;
Expand All @@ -36,7 +35,6 @@ impl LoweredRequirement {
project_dir: &Path,
project_sources: &BTreeMap<PackageName, Source>,
workspace: &Workspace,
preview: PreviewMode,
) -> Result<Self, LoweringError> {
let (source, origin) = if let Some(source) = project_sources.get(&requirement.name) {
(Some(source), Origin::Project)
Expand Down Expand Up @@ -80,10 +78,6 @@ impl LoweredRequirement {
return Ok(Self(Requirement::from(requirement)));
};

if preview.is_disabled() {
warn_user_once!("`uv.sources` is experimental and may change without warning");
}

let source = match source {
Source::Git {
git,
Expand Down Expand Up @@ -180,18 +174,13 @@ impl LoweredRequirement {
requirement: pep508_rs::Requirement<VerbatimParsedUrl>,
dir: &Path,
sources: &BTreeMap<PackageName, Source>,
preview: PreviewMode,
) -> Result<Self, LoweringError> {
let source = sources.get(&requirement.name).cloned();

let Some(source) = source else {
return Ok(Self(Requirement::from(requirement)));
};

if preview.is_disabled() {
warn_user_once!("`uv.sources` is experimental and may change without warning");
}

let source = match source {
Source::Git {
git,
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-distribution/src/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use thiserror::Error;

use pep440_rs::{Version, VersionSpecifiers};
use pypi_types::{HashDigest, Metadata23};
use uv_configuration::{PreviewMode, SourceStrategy};
use uv_configuration::SourceStrategy;
use uv_normalize::{ExtraName, GroupName, PackageName};
use uv_workspace::WorkspaceError;

Expand Down Expand Up @@ -61,7 +61,6 @@ impl Metadata {
install_path: &Path,
lock_path: &Path,
sources: SourceStrategy,
preview_mode: PreviewMode,
) -> Result<Self, MetadataError> {
// Lower the requirements.
let RequiresDist {
Expand All @@ -78,7 +77,6 @@ impl Metadata {
install_path,
lock_path,
sources,
preview_mode,
)
.await?;

Expand Down
10 changes: 2 additions & 8 deletions crates/uv-distribution/src/metadata/requires_dist.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use std::path::Path;

use uv_configuration::{PreviewMode, SourceStrategy};
use uv_configuration::SourceStrategy;
use uv_normalize::{ExtraName, GroupName, PackageName, DEV_DEPENDENCIES};
use uv_workspace::{DiscoveryOptions, ProjectWorkspace};

Expand Down Expand Up @@ -39,7 +39,6 @@ impl RequiresDist {
install_path: &Path,
lock_path: &Path,
sources: SourceStrategy,
preview_mode: PreviewMode,
) -> Result<Self, MetadataError> {
match sources {
SourceStrategy::Enabled => {
Expand All @@ -55,7 +54,7 @@ impl RequiresDist {
return Ok(Self::from_metadata23(metadata));
};

Self::from_project_workspace(metadata, &project_workspace, preview_mode)
Self::from_project_workspace(metadata, &project_workspace)
}
SourceStrategy::Disabled => Ok(Self::from_metadata23(metadata)),
}
Expand All @@ -64,7 +63,6 @@ impl RequiresDist {
fn from_project_workspace(
metadata: pypi_types::RequiresDist,
project_workspace: &ProjectWorkspace,
preview_mode: PreviewMode,
) -> Result<Self, MetadataError> {
// Collect any `tool.uv.sources` and `tool.uv.dev_dependencies` from `pyproject.toml`.
let empty = BTreeMap::default();
Expand Down Expand Up @@ -96,7 +94,6 @@ impl RequiresDist {
project_workspace.project_root(),
sources,
project_workspace.workspace(),
preview_mode,
)
.map(LoweredRequirement::into_inner)
.map_err(|err| MetadataError::LoweringError(requirement_name.clone(), err))
Expand All @@ -120,7 +117,6 @@ impl RequiresDist {
project_workspace.project_root(),
sources,
project_workspace.workspace(),
preview_mode,
)
.map(LoweredRequirement::into_inner)
.map_err(|err| MetadataError::LoweringError(requirement_name.clone(), err))
Expand Down Expand Up @@ -155,7 +151,6 @@ mod test {
use indoc::indoc;
use insta::assert_snapshot;

use uv_configuration::PreviewMode;
use uv_workspace::pyproject::PyProjectToml;
use uv_workspace::{DiscoveryOptions, ProjectWorkspace};

Expand All @@ -182,7 +177,6 @@ mod test {
Ok(RequiresDist::from_project_workspace(
requires_dist,
&project_workspace,
PreviewMode::Enabled,
)?)
}

Expand Down
Loading

0 comments on commit 58d51b0

Please sign in to comment.