pip/docs/html/reference/pip_hash.rst

75 lines
1.8 KiB
ReStructuredText
Raw Normal View History

2015-10-08 05:41:24 +02:00
.. _`pip hash`:
========
2015-10-08 05:41:24 +02:00
pip hash
========
2015-10-08 05:41:24 +02:00
.. contents::
2020-02-11 14:05:28 +01:00
2015-10-08 05:41:24 +02:00
Usage
2020-02-11 14:00:03 +01:00
=====
2015-10-08 05:41:24 +02:00
2020-10-18 19:12:24 +02:00
.. tab:: Unix/macOS
2020-08-06 22:06:10 +02:00
2020-10-18 19:12:24 +02:00
.. pip-command-usage:: hash "python -m pip"
2020-08-06 22:06:10 +02:00
2020-10-18 19:12:24 +02:00
.. tab:: Windows
2020-08-06 22:06:10 +02:00
2020-10-18 19:12:24 +02:00
.. pip-command-usage:: hash "py -m pip"
2015-10-08 05:41:24 +02:00
Description
2020-02-11 14:00:03 +01:00
===========
2015-10-08 05:41:24 +02:00
.. pip-command-description:: hash
Overview
2020-02-11 14:00:03 +01:00
--------
2015-10-08 05:41:24 +02:00
``pip hash`` is a convenient way to get a hash digest for use with
:ref:`hash-checking mode`, especially for packages with multiple archives. The
error message from ``pip install --require-hashes ...`` will give you one
hash, but, if there are multiple archives (like source and binary ones), you
2015-10-12 20:01:32 +02:00
will need to manually download and compute a hash for the others. Otherwise, a
spurious hash mismatch could occur when :ref:`pip install` is passed a
different set of options, like :ref:`--no-binary <install_--no-binary>`.
Options
2020-02-11 14:00:03 +01:00
=======
2015-10-12 20:01:32 +02:00
.. pip-command-options:: hash
2015-10-08 05:41:24 +02:00
Example
2020-02-11 14:00:03 +01:00
=======
2015-10-08 05:41:24 +02:00
2020-08-06 22:06:10 +02:00
Compute the hash of a downloaded archive:
2020-10-18 19:12:24 +02:00
.. tab:: Unix/macOS
2020-10-18 19:12:24 +02:00
.. code-block:: console
2020-10-18 19:12:24 +02:00
$ python -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
$ python -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0
2020-10-18 19:12:24 +02:00
.. tab:: Windows
2020-10-18 19:12:24 +02:00
.. code-block:: console
2020-10-18 19:12:24 +02:00
C:\> py -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
C:\> py -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0