Skip to content

Commit e4d4bb3

Browse files
authored
Update CLI usage for --all by moving it to the "render" group (#458)
It makes more sense for it to be in the "render" group as this option moreso affects how the output is rendered. This commit also does the following: - Update README.md with our current CLI usage - Update description of --depth to be more accurate - Update test_non_host.py to account for `readline` metadata removal in pypy-3.10.19
1 parent ad743dc commit e4d4bb3

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ In earlier versions, `--json`, `--json-tree` and `--graph-output` options overri
225225

226226
```bash
227227
% pipdeptree --help
228-
usage: pipdeptree [-h] [-v] [-w [{silence,suppress,fail}]] [--python PYTHON] [-p P] [-e P] [-a] [-l | -u] [-f] [--encoding E] [-d D] [-r] [--license] [-j | --json-tree | --mermaid | --graph-output FMT]
228+
usage: pipdeptree [-h] [-v] [-w [{silence,suppress,fail}]] [--python PYTHON] [--path PATH] [-p P] [-e P] [-l | -u] [-f] [--encoding E] [-a] [-d D] [-r] [--license] [-j | --json-tree | --mermaid | --graph-output FMT]
229229

230230
Dependency tree of the installed python packages
231231

@@ -239,11 +239,10 @@ options:
239239
select:
240240
choose what to render
241241
242-
--python PYTHON Python interpreter to inspect (default: /usr/local/bin/python)
242+
--python PYTHON Python interpreter to inspect. With "auto", it attempts to detect your virtual environment and fails if it can't. (default: /usr/local/bin/python)
243243
--path PATH Passes a path used to restrict where packages should be looked for (can be used multiple times) (default: None)
244244
-p P, --packages P comma separated list of packages to show - wildcards are supported, like 'somepackage.*' (default: None)
245245
-e P, --exclude P comma separated list of packages to not show - wildcards are supported, like 'somepackage.*'. (cannot combine with -p or -a) (default: None)
246-
-a, --all list all deps at top level (default: False)
247246
-l, --local-only if in a virtualenv that has global access do not show globally installed packages (default: False)
248247
-u, --user-only only show installations in the user site dir (default: False)
249248

@@ -252,7 +251,8 @@ render:
252251

253252
-f, --freeze print names so as to write freeze files (default: False)
254253
--encoding E the encoding to use when writing to the output (default: utf-8)
255-
-d D, --depth D limit the depth of the tree (text render only) (default: inf)
254+
-a, --all list all deps at top level (text and freeze render only) (default: False)
255+
-d D, --depth D limit the depth of the tree (text and freeze render only) (default: inf)
256256
-r, --reverse render the dependency tree in the reverse fashion ie. the sub-dependencies are listed with the list of packages that need them under them (default: False)
257257
--license list the license(s) of a package (text render only) (default: False)
258258
-j, --json raw JSON - this will yield output that may be used by external tools (default: False)

src/pipdeptree/_cli.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def build_parser() -> ArgumentParser:
8282
"(cannot combine with -p or -a)",
8383
metavar="P",
8484
)
85-
select.add_argument("-a", "--all", action="store_true", help="list all deps at top level")
8685

8786
scope = select.add_mutually_exclusive_group()
8887
scope.add_argument(
@@ -105,12 +104,15 @@ def build_parser() -> ArgumentParser:
105104
help="the encoding to use when writing to the output",
106105
metavar="E",
107106
)
107+
render.add_argument(
108+
"-a", "--all", action="store_true", help="list all deps at top level (text and freeze render only)"
109+
)
108110
render.add_argument(
109111
"-d",
110112
"--depth",
111113
type=lambda x: int(x) if x.isdigit() and (int(x) >= 0) else parser.error("Depth must be a number that is >= 0"),
112114
default=float("inf"),
113-
help="limit the depth of the tree (text render only)",
115+
help="limit the depth of the tree (text and freeze render only)",
114116
metavar="D",
115117
)
116118
render.add_argument(

tests/test_non_host.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def expected_venv_pkgs() -> frozenset[str]:
2222
if implementation == "CPython": # pragma: cpython cover
2323
expected = {"pip", "setuptools", "wheel"}
2424
elif implementation == "PyPy": # pragma: pypy cover
25-
expected = {"cffi", "greenlet", "pip", "readline", "hpy", "setuptools", "wheel"}
25+
expected = {"cffi", "greenlet", "pip", "hpy", "readline", "setuptools", "wheel"}
26+
if sys.version_info >= (3, 10): # pragma: >=3.10 cover
27+
expected -= {"readline"}
2628
else: # pragma: no cover
2729
raise ValueError(implementation)
2830
if sys.version_info >= (3, 12): # pragma: >=3.12 cover

0 commit comments

Comments
 (0)