Skip to content

Commit 10a5c5d

Browse files
committed
Clean up discussion page "install_requires vs requirements files"
This is outdated content that we decided to clean up, see issue 2170. It's referenced regularly as noted on that issue, so keep a stub with forward links to replacement content as an orphan page.
1 parent 561bce4 commit 10a5c5d

3 files changed

Lines changed: 12 additions & 82 deletions

File tree

‎source/contribute.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Discussions
6161

6262
Discussions are focused on understanding and information. These explore a
6363
specific topic without a specific goal in mind. :doc:`example discussion-style
64-
document <discussions/install-requires-vs-requirements>`.
64+
document <discussions/src-layout-vs-flat-layout>`.
6565

6666
Specifications
6767
--------------

‎source/discussions/index.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ specific topic. If you're just trying to get stuff done, see
99
:maxdepth: 1
1010

1111
versioning
12-
install-requires-vs-requirements
1312
distribution-package-vs-import-package
1413
package-formats
1514
src-layout-vs-flat-layout
Lines changed: 11 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,20 @@
1+
:orphan:
2+
13
.. _`install_requires vs requirements files`:
24

35
======================================
46
install_requires vs requirements files
57
======================================
68

9+
For documentation on these topics, see:
710

8-
install_requires
9-
----------------
10-
11-
``install_requires`` is a :ref:`setuptools` :file:`setup.py` keyword that
12-
should be used to specify what a project **minimally** needs to run correctly.
13-
When the project is installed by :ref:`pip`, this is the specification that is
14-
used to install its dependencies.
15-
16-
For example, if the project requires A and B, your ``install_requires`` would be
17-
like so:
18-
19-
::
20-
21-
install_requires=[
22-
'A',
23-
'B'
24-
]
25-
26-
Additionally, it's best practice to indicate any known lower or upper bounds.
27-
28-
For example, it may be known, that your project requires at least v1 of 'A', and
29-
v2 of 'B', so it would be like so:
30-
31-
::
32-
33-
install_requires=[
34-
'A>=1',
35-
'B>=2'
36-
]
37-
38-
It may also be known that project 'A' introduced a change in its v2
39-
that breaks the compatibility of your project with v2 of 'A' and later,
40-
so it makes sense to not allow v2:
41-
42-
::
43-
44-
install_requires=[
45-
'A>=1,<2',
46-
'B>=2'
47-
]
48-
49-
It is not considered best practice to use ``install_requires`` to pin
50-
dependencies to specific versions, or to specify sub-dependencies
51-
(i.e. dependencies of your dependencies). This is overly-restrictive, and
52-
prevents the user from gaining the benefit of dependency upgrades.
53-
54-
Lastly, it's important to understand that ``install_requires`` is a listing of
55-
"Abstract" requirements, i.e just names and version restrictions that don't
56-
determine where the dependencies will be fulfilled from (i.e. from what
57-
index or source). The where (i.e. how they are to be made "Concrete") is to
58-
be determined at install time using :ref:`pip` options. [1]_
59-
60-
61-
Requirements files
62-
------------------
63-
64-
:ref:`Requirements Files <pip:Requirements Files>` described most simply, are
65-
just a list of :ref:`pip:pip install` arguments placed into a file.
66-
67-
Whereas ``install_requires`` defines the dependencies for a single project,
68-
:ref:`Requirements Files <pip:Requirements Files>` are often used to define
69-
the requirements for a complete Python environment.
70-
71-
Whereas ``install_requires`` requirements are minimal, requirements files
72-
often contain an exhaustive listing of pinned versions for the purpose of
73-
achieving :ref:`repeatable installations <pip:Repeatability>` of a complete
74-
environment.
75-
76-
Whereas ``install_requires`` requirements are "Abstract", i.e. not associated
77-
with any particular index, requirements files often contain pip
78-
options like ``--index-url`` or ``--find-links`` to make requirements
79-
"Concrete", i.e. associated with a particular index or directory of
80-
packages. [1]_
81-
82-
Whereas ``install_requires`` metadata is automatically analyzed by pip during an
83-
install, requirements files are not, and only are used when a user specifically
84-
installs them using ``python -m pip install -r``.
11+
* ``install_requires``: `Declaring required dependency`_ in the setuptools documentation.
12+
* :file:`requirements.txt`: `Requirements File Format`_ in the pip documentation.
8513

86-
----
14+
This page previously explained abstract versus concrete requirements. For an
15+
explanation of that distinction, see `setup.py vs requirements.txt`_ by Donald
16+
Stufft.
8717

88-
.. [1] For more on "Abstract" vs "Concrete" requirements, see
89-
https://caremad.io/posts/2013/07/setup-vs-requirement/.
18+
.. _Declaring required dependency: https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#declaring-required-dependency
19+
.. _Requirements File Format: https://pip.pypa.io/en/stable/reference/requirements-file-format/
20+
.. _setup.py vs requirements.txt: https://caremad.io/posts/2013/07/setup-vs-requirement/

0 commit comments

Comments
 (0)