Remove uv 0.7.13 (62ed17b23 2025-06-12) fallback

This commit is contained in:
Aria Desires 2025-06-20 11:37:09 -04:00
parent e9d5780369
commit 95eafe68f9
3 changed files with 17 additions and 54 deletions

View file

@ -19,7 +19,6 @@ use uv_pep440::Version;
use uv_pep508::PackageName;
use uv_python::{PythonDownloads, PythonPreference, PythonRequest};
use uv_settings::PythonInstallMirrors;
use uv_warnings::warn_user;
use uv_workspace::pyproject_mut::Error;
use uv_workspace::{
DiscoveryOptions, WorkspaceCache,
@ -58,7 +57,6 @@ pub(crate) async fn project_version(
bump: Option<VersionBump>,
short: bool,
output_format: VersionFormat,
strict: bool,
project_dir: &Path,
package: Option<PackageName>,
dry_run: bool,
@ -80,21 +78,7 @@ pub(crate) async fn project_version(
preview: PreviewMode,
) -> Result<ExitStatus> {
// Read the metadata
let project = match find_target(project_dir, package.as_ref()).await {
Ok(target) => target,
Err(err) => {
// If strict, hard bail on failing to find the pyproject.toml
if strict {
return Err(err)?;
}
// Otherwise, warn and provide fallback to the old `uv version` from before 0.7.0
warn_user!(
"Failed to read project metadata ({err}). Running `{}` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.",
"uv self version".green()
);
return self_version(short, output_format, printer);
}
};
let project = find_target(project_dir, package.as_ref()).await?;
let pyproject_path = project.root().join("pyproject.toml");
let Some(name) = project.project_name().cloned() else {

View file

@ -1056,7 +1056,6 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
}
Commands::Project(project) => {
Box::pin(run_project(
cli.top_level.global_args.project.is_some(),
project,
&project_dir,
run_command,
@ -1647,7 +1646,6 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
/// Run a [`ProjectCommand`].
async fn run_project(
project_was_explicit: bool,
project_command: Box<ProjectCommand>,
project_dir: &Path,
command: Option<RunCommand>,
@ -2036,19 +2034,11 @@ async fn run_project(
.combine(Refresh::from(args.settings.resolver.upgrade.clone())),
);
// If they specified any of these flags, they probably don't mean `uv self version`
let strict = project_was_explicit
|| globals.preview.is_enabled()
|| args.dry_run
|| args.bump.is_some()
|| args.value.is_some()
|| args.package.is_some();
Box::pin(commands::project_version(
args.value,
args.bump,
args.short,
args.output_format,
strict,
project_dir,
args.package,
args.dry_run,

View file

@ -841,8 +841,10 @@ fn version_set_dynamic() -> Result<()> {
Ok(())
}
// Should fallback to `uv --version` if this pyproject.toml isn't usable for whatever reason
// Previously would fallback to `uv --version` if this pyproject.toml isn't usable for whatever reason
// (In this case, because tool.uv.managed = false)
//
// This fallback path is now deprecated and we just get an error.
#[test]
fn version_get_fallback_unmanaged() -> Result<()> {
let context = TestContext::new("3.12");
@ -860,13 +862,12 @@ fn version_get_fallback_unmanaged() -> Result<()> {
)?;
uv_snapshot!(context.filters(), context.version(), @r"
success: true
exit_code: 0
success: false
exit_code: 2
----- stdout -----
uv [VERSION] ([COMMIT] DATE)
----- stderr -----
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
error: The project is marked as unmanaged: `[TEMP_DIR]/`
");
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
@ -911,13 +912,12 @@ fn version_get_fallback_unmanaged_short() -> Result<()> {
.collect::<Vec<_>>();
uv_snapshot!(filters, context.version()
.arg("--short"), @r"
success: true
exit_code: 0
success: false
exit_code: 2
----- stdout -----
[VERSION] ([COMMIT] DATE)
----- stderr -----
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
error: The project is marked as unmanaged: `[TEMP_DIR]/`
");
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
@ -988,25 +988,14 @@ fn version_get_fallback_unmanaged_json() -> Result<()> {
.collect::<Vec<_>>();
if git_version_info_expected() {
uv_snapshot!(filters, context.version()
.arg("--output-format").arg("json"), @r#"
success: true
exit_code: 0
----- stdout -----
{
"package_name": "uv",
"version": "[VERSION]",
"commit_info": {
"short_commit_hash": "[LONGHASH]",
"commit_hash": "[LONGHASH]",
"commit_date": "[DATE]",
"last_tag": "[TAG]",
"commits_since_last_tag": [COUNT]
}
}
.arg("--output-format").arg("json"), @r"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
"#);
----- stderr -----
error: The project is marked as unmanaged: `[TEMP_DIR]/`
");
} else {
uv_snapshot!(filters, context.version()
.arg("--output-format").arg("json"), @r#"