mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-03 15:24:36 +00:00
Add uv version to debug output (#4259)
## Summary
I think this is a useful piece of connective tissue that will let us
avoid back-and-forths when folks include traces.
## Test Plan
```
❯ cargo run pip list --verbose
DEBUG uv 0.2.11 (44041bccd
2024-06-11)
DEBUG Searching for Python interpreter in virtual environments
DEBUG Found CPython 3.12.3 at `/Users/crmarsh/workspace/puffin/.venv/bin/python3` (virtual environment)
DEBUG Using Python 3.12.3 environment at .venv/bin/python3
```
This commit is contained in:
parent
8a8e1af513
commit
034b4790ea
2 changed files with 21 additions and 3 deletions
|
@ -8,7 +8,7 @@ use anyhow::Result;
|
||||||
use clap::error::{ContextKind, ContextValue};
|
use clap::error::{ContextKind, ContextValue};
|
||||||
use clap::{CommandFactory, Parser};
|
use clap::{CommandFactory, Parser};
|
||||||
use owo_colors::OwoColorize;
|
use owo_colors::OwoColorize;
|
||||||
use tracing::instrument;
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
use cli::{ToolCommand, ToolNamespace, ToolchainCommand, ToolchainNamespace};
|
use cli::{ToolCommand, ToolNamespace, ToolchainCommand, ToolchainNamespace};
|
||||||
use uv_cache::Cache;
|
use uv_cache::Cache;
|
||||||
|
@ -174,6 +174,8 @@ async fn run() -> Result<ExitStatus> {
|
||||||
)
|
)
|
||||||
}))?;
|
}))?;
|
||||||
|
|
||||||
|
debug!("uv {}", version::version());
|
||||||
|
|
||||||
// Resolve the cache settings.
|
// Resolve the cache settings.
|
||||||
let cache = CacheSettings::resolve(cli.cache_args, workspace.as_ref());
|
let cache = CacheSettings::resolve(cli.cache_args, workspace.as_ref());
|
||||||
let cache = Cache::from_settings(cache.no_cache, cache.cache_dir)?;
|
let cache = Cache::from_settings(cache.no_cache, cache.cache_dir)?;
|
||||||
|
|
|
@ -68,12 +68,19 @@ fn prune_no_op() -> Result<()> {
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), prune_command(&context).arg("--verbose"), @r###"
|
let filters: Vec<_> = context
|
||||||
|
.filters()
|
||||||
|
.into_iter()
|
||||||
|
.chain([(r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)")])
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
uv_snapshot!(filters, prune_command(&context).arg("--verbose"), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
DEBUG uv [VERSION] ([COMMIT] DATE)
|
||||||
Pruning cache at: [CACHE_DIR]/
|
Pruning cache at: [CACHE_DIR]/
|
||||||
No unused entries found
|
No unused entries found
|
||||||
"###);
|
"###);
|
||||||
|
@ -99,12 +106,19 @@ fn prune_stale_directory() -> Result<()> {
|
||||||
let simple = context.cache_dir.child("simple-v4");
|
let simple = context.cache_dir.child("simple-v4");
|
||||||
simple.create_dir_all()?;
|
simple.create_dir_all()?;
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), prune_command(&context).arg("--verbose"), @r###"
|
let filters: Vec<_> = context
|
||||||
|
.filters()
|
||||||
|
.into_iter()
|
||||||
|
.chain([(r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)")])
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
uv_snapshot!(filters, prune_command(&context).arg("--verbose"), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
DEBUG uv [VERSION] ([COMMIT] DATE)
|
||||||
Pruning cache at: [CACHE_DIR]/
|
Pruning cache at: [CACHE_DIR]/
|
||||||
DEBUG Removing dangling cache entry: [CACHE_DIR]/simple-v4
|
DEBUG Removing dangling cache entry: [CACHE_DIR]/simple-v4
|
||||||
Removed 1 directory
|
Removed 1 directory
|
||||||
|
@ -135,6 +149,7 @@ fn prune_stale_symlink() -> Result<()> {
|
||||||
.filters()
|
.filters()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain([
|
.chain([
|
||||||
|
(r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)"),
|
||||||
// The cache entry does not have a stable key, so we filter it out
|
// The cache entry does not have a stable key, so we filter it out
|
||||||
(
|
(
|
||||||
r"\[CACHE_DIR\](\\|\/)(.+)(\\|\/).*",
|
r"\[CACHE_DIR\](\\|\/)(.+)(\\|\/).*",
|
||||||
|
@ -149,6 +164,7 @@ fn prune_stale_symlink() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
DEBUG uv [VERSION] ([COMMIT] DATE)
|
||||||
Pruning cache at: [CACHE_DIR]/
|
Pruning cache at: [CACHE_DIR]/
|
||||||
DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY]
|
DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY]
|
||||||
Removed 44 files ([SIZE])
|
Removed 44 files ([SIZE])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue