Skip to content

Commit 78b42de

Browse files
committed
Added doc for header and json format for pip show
1 parent d49b4da commit 78b42de

File tree

2 files changed

+163
-2
lines changed

2 files changed

+163
-2
lines changed

docs/html/reference/pip_show.rst

Lines changed: 162 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,50 @@ Options
2525
.. pip-command-options:: show
2626

2727

28+
Format
29+
======
30+
31+
The various fields in the output and their explanation is as follows. Note that the keys in JSON format are lowercased.
32+
The fields below are present in the METADATA file, which follows the specification
33+
laid down in `PEP-241`_, `PEP-314`_ and `PEP-345`_, with the same name as the fields, unless otherwise noted
34+
35+
The following fields are exposed by default.
36+
37+
- Name: The name of the distribution.
38+
- Version: A string containing the distribution's version number.
39+
- Summary: A one-line summary of what the distribution does.
40+
- Home-page: A string containing the URL for the distribution's home page.
41+
- Author: A string containing the author's name at a minimum; additional contact information may be provided.
42+
- Author-email: A string containing the author's e-mail address.
43+
- License: Text indicating the license covering the distribution where the license is not a selection from the "License" Trove classifiers.
44+
This field may also be used to specify a particular version of a license which is named via the Classifier field, or to indicate a variation or exception to such a license.
45+
- Location: A string containing the path where the distribution is installed.
46+
- Requires: Each entry contains a string describing some other module or package required by this package. (Requires-Dist in METADATA file)
47+
- Required-by: Each entry contains a string describing some dependency in the system that the distribution is to be used.
48+
This is fetched by listing all distributions for which this distribution is in Requires-Dist of their METADATA file.
49+
50+
In verbose mode you also have access to:
51+
52+
- Metadata-Version: Version of the file format
53+
- Installer: Value to to keep track of who installed the distribution (Defined in he `INSTALLER`_ section of PEP-376)
54+
- Classifiers: Each entry is a string giving a single classification value for the distribution.
55+
- Entry-points: Components provided by the distribution to be discovered and used by other code (Defined in `entry point specifications`_ of Python Packaging User Guide)
56+
57+
Finally, in files mode, you have access to:
58+
59+
- Files: List of installed files by the distribution (Defined in the `RECORD`_ section of PEP-376)
60+
61+
.. _PEP-241: https://www.python.org/dev/peps/pep-0241/
62+
.. _PEP-314: https://www.python.org/dev/peps/pep-0314/
63+
.. _PEP-345: https://www.python.org/dev/peps/pep-0345/
64+
.. _INSTALLER: https://www.python.org/dev/peps/pep-0376/#installer
65+
.. _RECORD: https://www.python.org/dev/peps/pep-0376/#record
66+
.. _`entry point specifications`: https://packaging.python.org/specifications/entry-points/
67+
2868
Examples
2969
========
3070

31-
#. Show information about a package:
71+
#. Show information about a package in header format:
3272

3373
::
3474

@@ -43,7 +83,50 @@ Examples
4383
Location: /my/env/lib/python2.7/site-packages
4484
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
4585

46-
#. Show all information about a package
86+
#. Show all information about a package in header format excluding files:
87+
88+
::
89+
90+
$ pip show --verbose sphinx
91+
Name: Sphinx
92+
Version: 1.4.5
93+
Summary: Python documentation generator
94+
Home-page: http://sphinx-doc.org/
95+
Author: Georg Brandl
96+
Author-email: [email protected]
97+
License: BSD
98+
Location: /my/env/lib/python2.7/site-packages
99+
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
100+
Metadata-Version: 2.0
101+
Installer:
102+
Classifiers:
103+
Development Status :: 5 - Production/Stable
104+
Environment :: Console
105+
Environment :: Web Environment
106+
Intended Audience :: Developers
107+
Intended Audience :: Education
108+
License :: OSI Approved :: BSD License
109+
Operating System :: OS Independent
110+
Programming Language :: Python
111+
Programming Language :: Python :: 2
112+
Programming Language :: Python :: 3
113+
Framework :: Sphinx
114+
Framework :: Sphinx :: Extension
115+
Framework :: Sphinx :: Theme
116+
Topic :: Documentation
117+
Topic :: Documentation :: Sphinx
118+
Topic :: Text Processing
119+
Topic :: Utilities
120+
Entry-points:
121+
[console_scripts]
122+
sphinx-apidoc = sphinx.apidoc:main
123+
sphinx-autogen = sphinx.ext.autosummary.generate:main
124+
sphinx-build = sphinx:main
125+
sphinx-quickstart = sphinx.quickstart:main
126+
[distutils.commands]
127+
build_sphinx = sphinx.setup_command:BuildDoc
128+
129+
#. Show all information about a package in header format including files:
47130

48131
::
49132

@@ -85,3 +168,80 @@ Examples
85168
sphinx-quickstart = sphinx.quickstart:main
86169
[distutils.commands]
87170
build_sphinx = sphinx.setup_command:BuildDoc
171+
Files:
172+
../../../bin/sphinx-apidoc
173+
../../../bin/sphinx-autogen
174+
../../../bin/sphinx-build
175+
../../../bin/sphinx-quickstart
176+
Sphinx-1.4.5.dist-info/DESCRIPTION.rst
177+
Sphinx-1.4.5.dist-info/INSTALLER
178+
Sphinx-1.4.5.dist-info/METADATA
179+
Sphinx-1.4.5.dist-info/RECORD
180+
Sphinx-1.4.5.dist-info/WHEEL
181+
Sphinx-1.4.5.dist-info/entry_points.txt
182+
Sphinx-1.4.5.dist-info/metadata.json
183+
Sphinx-1.4.5.dist-info/top_level.txt
184+
.....
185+
186+
#. Show information about a package in json format:
187+
188+
::
189+
190+
$ pip show sphinx
191+
[{
192+
"name": "Sphinx",
193+
"version": "1.4.5",
194+
"summary": "Python documentation generator",
195+
"home-page": "http://sphinx-doc.org/",
196+
"author": "Georg Brandl",
197+
"author-email": "[email protected]",
198+
"license": "BSD",
199+
"location": "/Users/devesh/pip/.env/lib/python3.8/site-packages",
200+
"requires": ["snowballstemmer", "babel", "alabaster", "six", "docutils", "imagesize", "Pygments", "Jinja2"],
201+
"required-by": []
202+
}]
203+
204+
#. Show all information about a package in json format excluding files:
205+
206+
::
207+
208+
$ pip show --verbose sphinx --format=json
209+
[{
210+
"name": "Sphinx",
211+
"version": "1.4.5",
212+
"summary": "Python documentation generator",
213+
"home-page": "http://sphinx-doc.org/",
214+
"author": "Georg Brandl",
215+
"author-email": "[email protected]",
216+
"license": "BSD",
217+
"location": "/Users/devesh/pip/.env/lib/python3.8/site-packages",
218+
"requires": ["docutils", "babel", "snowballstemmer", "Pygments", "alabaster", "six", "Jinja2", "imagesize"],
219+
"required-by": [],
220+
"metadata-version": "2.0",
221+
"installer": "pip",
222+
"classifiers": ["Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Framework :: Sphinx", "Framework :: Sphinx :: Extension", "Framework :: Sphinx :: Theme", "Topic :: Documentation", "Topic :: Documentation :: Sphinx", "Topic :: Text Processing", "Topic :: Utilities"],
223+
"entry-points": ["[console_scripts]", "sphinx-apidoc = sphinx.apidoc:main", "sphinx-autogen = sphinx.ext.autosummary.generate:main", "sphinx-build = sphinx:main", "sphinx-quickstart = sphinx.quickstart:main", "[distutils.commands]", "build_sphinx = sphinx.setup_command:BuildDoc"]
224+
}]
225+
226+
#. Show all information about a package in json format including files:
227+
228+
::
229+
230+
$ pip show --verbose -f sphinx --format=json
231+
[{
232+
"name": "Sphinx",
233+
"version": "1.4.5",
234+
"summary": "Python documentation generator",
235+
"home-page": "http://sphinx-doc.org/",
236+
"author": "Georg Brandl",
237+
"author-email": "[email protected]",
238+
"license": "BSD",
239+
"location": "/Users/devesh/pip/.env/lib/python3.8/site-packages",
240+
"requires": ["Jinja2", "docutils", "babel", "snowballstemmer", "alabaster", "imagesize", "six", "Pygments"],
241+
"required-by": [],
242+
"metadata-version": "2.0",
243+
"installer": "pip",
244+
"classifiers": ["Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Framework :: Sphinx", "Framework :: Sphinx :: Extension", "Framework :: Sphinx :: Theme", "Topic :: Documentation", "Topic :: Documentation :: Sphinx", "Topic :: Text Processing", "Topic :: Utilities"],
245+
"entry-points": ["[console_scripts]", "sphinx-apidoc = sphinx.apidoc:main", "sphinx-autogen = sphinx.ext.autosummary.generate:main", "sphinx-build = sphinx:main", "sphinx-quickstart = sphinx.quickstart:main", "[distutils.commands]", "build_sphinx = sphinx.setup_command:BuildDoc"],
246+
"files": ["../../../bin/sphinx-apidoc", "../../../bin/sphinx-autogen", "../../../bin/sphinx-build", "../../../bin/sphinx-quickstart", "Sphinx-1.4.5.dist-info/DESCRIPTION.rst", "Sphinx-1.4.5.dist-info/INSTALLER", "Sphinx-1.4.5.dist-info/METADATA", "Sphinx-1.4.5.dist-info/RECORD", "Sphinx-1.4.5.dist-info/WHEEL", "Sphinx-1.4.5.dist-info/entry_points.txt", "Sphinx-1.4.5.dist-info/metadata.json", "Sphinx-1.4.5.dist-info/top_level.txt"]
247+
}]

news/5261.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added documentation for pip show header and json format

0 commit comments

Comments
 (0)