File tree Expand file tree Collapse file tree 6 files changed +71
-0
lines changed Expand file tree Collapse file tree 6 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -2005,6 +2005,10 @@ pub struct PipShowArgs {
20052005 #[ arg( long, overrides_with( "strict" ) , hide = true ) ]
20062006 pub no_strict : bool ,
20072007
2008+ /// Show the full list of installed files for each package.
2009+ #[ arg( short, long) ]
2010+ pub files : bool ,
2011+
20082012 /// The Python interpreter to find the package in.
20092013 ///
20102014 /// By default, uv looks for packages in a virtual environment but will look
Original file line number Diff line number Diff line change 11use std:: fmt:: Write ;
22
33use anyhow:: Result ;
4+ use fs_err:: File ;
45use itertools:: { Either , Itertools } ;
56use owo_colors:: OwoColorize ;
67use rustc_hash:: FxHashMap ;
78
89use uv_cache:: Cache ;
910use uv_distribution_types:: { Diagnostic , Name } ;
1011use uv_fs:: Simplified ;
12+ use uv_install_wheel:: read_record_file;
1113use uv_installer:: SitePackages ;
1214use uv_normalize:: PackageName ;
1315use uv_python:: { EnvironmentPreference , PythonEnvironment , PythonRequest } ;
@@ -22,6 +24,7 @@ pub(crate) fn pip_show(
2224 strict : bool ,
2325 python : Option < & str > ,
2426 system : bool ,
27+ files : bool ,
2528 cache : & Cache ,
2629 printer : Printer ,
2730) -> Result < ExitStatus > {
@@ -184,6 +187,16 @@ pub(crate) fn pip_show(
184187 ) ?;
185188 }
186189 }
190+
191+ // If requests, show the list of installed files.
192+ if files {
193+ let path = distribution. path ( ) . join ( "RECORD" ) ;
194+ let record = read_record_file ( & mut File :: open ( path) ?) ?;
195+ writeln ! ( printer. stdout( ) , "Files:" ) ?;
196+ for entry in record {
197+ writeln ! ( printer. stdout( ) , " {}" , entry. path) ?;
198+ }
199+ }
187200 }
188201
189202 // Validate that the environment is consistent.
Original file line number Diff line number Diff line change @@ -624,6 +624,7 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
624624 args. settings . strict ,
625625 args. settings . python . as_deref ( ) ,
626626 args. settings . system ,
627+ args. files ,
627628 & cache,
628629 printer,
629630 )
Original file line number Diff line number Diff line change @@ -1628,6 +1628,7 @@ impl PipListSettings {
16281628#[ derive( Debug , Clone ) ]
16291629pub ( crate ) struct PipShowSettings {
16301630 pub ( crate ) package : Vec < PackageName > ,
1631+ pub ( crate ) files : bool ,
16311632 pub ( crate ) settings : PipSettings ,
16321633}
16331634
@@ -1638,6 +1639,7 @@ impl PipShowSettings {
16381639 package,
16391640 strict,
16401641 no_strict,
1642+ files,
16411643 python,
16421644 system,
16431645 no_system,
@@ -1646,6 +1648,7 @@ impl PipShowSettings {
16461648
16471649 Self {
16481650 package,
1651+ files,
16491652 settings : PipSettings :: combine (
16501653 PipOptions {
16511654 python : python. and_then ( Maybe :: into_option) ,
Original file line number Diff line number Diff line change @@ -458,3 +458,51 @@ fn show_required_by_multiple() -> Result<()> {
458458
459459 Ok ( ( ) )
460460}
461+
462+ #[ test]
463+ fn show_files ( ) {
464+ let context = TestContext :: new ( "3.12" ) ;
465+
466+ uv_snapshot ! ( context
467+ . pip_install( )
468+ . arg( "MarkupSafe==2.1.3" )
469+ . arg( "--strict" ) , @r#"
470+ success: true
471+ exit_code: 0
472+ ----- stdout -----
473+
474+ ----- stderr -----
475+ Resolved 1 package in [TIME]
476+ Prepared 1 package in [TIME]
477+ Installed 1 package in [TIME]
478+ + markupsafe==2.1.3
479+ "#
480+ ) ;
481+
482+ uv_snapshot ! ( context. pip_show( ) . arg( "markupsafe" ) . arg( "--files" ) , @r#"
483+ success: true
484+ exit_code: 0
485+ ----- stdout -----
486+ Name: markupsafe
487+ Version: 2.1.3
488+ Location: /Users/Jo/.local/share/uv/tests/.tmpxusOsE/temp/.venv/lib/python3.12/site-packages
489+ Requires:
490+ Required-by:
491+ Files:
492+ MarkupSafe-2.1.3.dist-info/INSTALLER
493+ MarkupSafe-2.1.3.dist-info/LICENSE.rst
494+ MarkupSafe-2.1.3.dist-info/METADATA
495+ MarkupSafe-2.1.3.dist-info/RECORD
496+ MarkupSafe-2.1.3.dist-info/REQUESTED
497+ MarkupSafe-2.1.3.dist-info/WHEEL
498+ MarkupSafe-2.1.3.dist-info/top_level.txt
499+ markupsafe/__init__.py
500+ markupsafe/_native.py
501+ markupsafe/_speedups.c
502+ markupsafe/_speedups.cpython-312-darwin.so
503+ markupsafe/_speedups.pyi
504+ markupsafe/py.typed
505+
506+ ----- stderr -----
507+ "# ) ;
508+ }
Original file line number Diff line number Diff line change @@ -6440,6 +6440,8 @@ uv pip show [OPTIONS] [PACKAGE]...
64406440
64416441<p >See <code >--project</code > to only change the project root directory.</p >
64426442
6443+ </dd ><dt ><code >--files</code >, <code >-f</code ></dt ><dd ><p >Show the full list of installed files for each package</p >
6444+
64436445</dd ><dt ><code >--help</code >, <code >-h</code ></dt ><dd ><p >Display the concise help for this command</p >
64446446
64456447</dd ><dt ><code >--native-tls</code ></dt ><dd ><p >Whether to load TLS certificates from the platform’ ; s native certificate store.</p >
You can’t perform that action at this time.
0 commit comments