@@ -122,7 +122,7 @@ installed by pip in any particular order.
122
122
In practice, there are 4 common uses of Requirements files:
123
123
124
124
1. Requirements files are used to hold the result from :ref: `pip freeze ` for the
125
- purpose of achieving :ref: ` repeatable installations < Repeatability > `. In
125
+ purpose of achieving :doc: ` topics/ repeatable-installs `. In
126
126
this case, your requirement file contains a pinned version of everything that
127
127
was installed when ``pip freeze `` was run.
128
128
@@ -762,86 +762,7 @@ is the latest version:
762
762
Ensuring Repeatability
763
763
======================
764
764
765
- pip can achieve various levels of repeatability:
766
-
767
- Pinned Version Numbers
768
- ----------------------
769
-
770
- Pinning the versions of your dependencies in the requirements file
771
- protects you from bugs or incompatibilities in newly released versions::
772
-
773
- SomePackage == 1.2.3
774
- DependencyOfSomePackage == 4.5.6
775
-
776
- Using :ref: `pip freeze ` to generate the requirements file will ensure that not
777
- only the top-level dependencies are included but their sub-dependencies as
778
- well, and so on. Perform the installation using :ref: `--no-deps
779
- <install_--no-deps>` for an extra dose of insurance against installing
780
- anything not explicitly listed.
781
-
782
- This strategy is easy to implement and works across OSes and architectures.
783
- However, it trusts PyPI and the certificate authority chain. It
784
- also relies on indices and find-links locations not allowing
785
- packages to change without a version increase. (PyPI does protect
786
- against this.)
787
-
788
- Hash-checking Mode
789
- ------------------
790
-
791
- Beyond pinning version numbers, you can add hashes against which to verify
792
- downloaded packages::
793
-
794
- FooProject == 1.2 --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
795
-
796
- This protects against a compromise of PyPI or the HTTPS
797
- certificate chain. It also guards against a package changing
798
- without its version number changing (on indexes that allow this).
799
- This approach is a good fit for automated server deployments.
800
-
801
- Hash-checking mode is a labor-saving alternative to running a private index
802
- server containing approved packages: it removes the need to upload packages,
803
- maintain ACLs, and keep an audit trail (which a VCS gives you on the
804
- requirements file for free). It can also substitute for a vendor library,
805
- providing easier upgrades and less VCS noise. It does not, of course,
806
- provide the availability benefits of a private index or a vendor library.
807
-
808
- For more, see
809
- :ref: `pip install\' s discussion of hash-checking mode <hash-checking mode >`.
810
-
811
- .. _`Installation Bundle` :
812
-
813
- Installation Bundles
814
- --------------------
815
-
816
- Using :ref: `pip wheel `, you can bundle up all of a project's dependencies, with
817
- any compilation done, into a single archive. This allows installation when
818
- index servers are unavailable and avoids time-consuming recompilation. Create
819
- an archive like this::
820
-
821
- $ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
822
- $ python -m pip wheel -r requirements.txt --wheel-dir=$tempdir
823
- $ cwd=`pwd`
824
- $ (cd "$tempdir"; tar -cjvf "$cwd/bundled.tar.bz2" *)
825
-
826
- You can then install from the archive like this::
827
-
828
- $ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
829
- $ (cd $tempdir; tar -xvf /path/to/bundled.tar.bz2)
830
- $ python -m pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps $tempdir/*
831
-
832
- Note that compiled packages are typically OS- and architecture-specific, so
833
- these archives are not necessarily portable across machines.
834
-
835
- Hash-checking mode can be used along with this method to ensure that future
836
- archives are built with identical packages.
837
-
838
- .. warning ::
839
-
840
- Finally, beware of the ``setup_requires `` keyword arg in :file: `setup.py `.
841
- The (rare) packages that use it will cause those dependencies to be
842
- downloaded by setuptools directly, skipping pip's protections. If you need
843
- to use such a package, see :ref: `Controlling
844
- setup_requires<controlling-setup-requires>`.
765
+ This is now covered in :doc: `../topics/repeatable-installs `.
845
766
846
767
.. _`Fixing conflicting dependencies` :
847
768
0 commit comments