Skip to content

Commit 14de9c3

Browse files
committed
Merge pull request pypa#132 from qwcode/PEP440
PEP440 updates
2 parents 7781987 + c1d1fbe commit 14de9c3

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed

source/glossary.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ Glossary
158158
:ref:`pip:pip install` reference.
159159

160160

161+
Requirement Specifier
162+
163+
A format used by :ref:`pip` to install packages from a :term:`Package
164+
Index`. For an EBNF diagram of the format, see the
165+
`pkg_resources.Requirement
166+
<https://pythonhosted.org/setuptools/pkg_resources.html#requirement-objects>`_
167+
entry in the :ref:`setuptools` docs. For example, "foo>=1.3" is a
168+
requirement specifier, where "foo" is the project name, and the ">=1.3"
169+
portion is the :term:`Version Specifier`
170+
161171
Requirements File
162172

163173
A file containing a list of :term:`Requirements <Requirement>` that can
@@ -191,6 +201,15 @@ Glossary
191201
e.g. an rpm or dpkg file.
192202

193203

204+
Version Specifier
205+
206+
The version component of a :term:`Requirement Specifier`. For example,
207+
the ">=1.3" portion of "foo>=1.3". :ref:`PEP440 <pypa:PEP440s>` contains
208+
a `full specification
209+
<https://www.python.org/dev/peps/pep-0440/#version-specifiers>`_ of the
210+
specifiers that Python packaging currently supports. Support for PEP440
211+
was implemented in :ref:`setuptools` v8.0 and :ref:`pip` v6.0.
212+
194213
Virtual Environment
195214

196215
An isolated Python environment that allows packages to be installed for

source/installing.rst

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,45 @@ Topics <additional>` section.
137137
Installing from PyPI
138138
====================
139139

140-
Install `SomeProject` and its dependencies from :term:`PyPI <Python Package
141-
Index (PyPI)>` using :ref:`pip:Requirement Specifiers`
140+
The most common usage of :ref:`pip` is to install from the :term:`Python Package
141+
Index <Python Package Index (PyPI)>` using a :term:`requirement specifier
142+
<Requirement Specifier>`. Generally speaking, a requirement specifier is
143+
composed of a project name followed by an optional :term:`version specifier
144+
<Version Specifier>`. :ref:`PEP440 <pypa:PEP440s>` contains a `full
145+
specification <https://www.python.org/dev/peps/pep-0440/#version-specifiers>`_
146+
of the currently supported specifiers. Below are some examples.
147+
148+
To install the latest version of "SomeProject":
142149

143150
::
144151

145-
pip install SomeProject # latest version
146-
pip install SomeProject==1.0.4 # specific version
147-
pip install 'SomeProject>=1.0.4' # minimum version
152+
pip install 'SomeProject'
153+
154+
155+
To install a specific version:
156+
157+
::
158+
159+
pip install 'SomeProject==1.4'
160+
161+
162+
To install greater than or equal to one version and less than another:
163+
164+
::
165+
166+
pip install 'SomeProject>=1,<2'
167+
168+
169+
To install a version that's `"compatible"
170+
<https://www.python.org/dev/peps/pep-0440/#compatible-release>`_ with a certain
171+
version: [5]_
172+
173+
::
174+
175+
pip install 'SomeProject~=1.4.2'
176+
177+
In this case, this means to install any version "==1.4.*" version that's also
178+
">=1.4.2".
148179

149180

150181
Upgrading packages
@@ -337,7 +368,9 @@ Install `setuptools extras`_.
337368
pre-installed, thereby making it an equal alternative to
338369
:ref:`virtualenv`.
339370
340-
.. [5]
371+
.. [5] The compatible release specifier was accepted in :ref:`PEP440
372+
<pypa:PEP440s>` and support was released in :ref:`setuptools` v8.0 and
373+
:ref:`pip` v6.0
341374
342375
.. _pyvenv: http://docs.python.org/3.4/library/venv.html
343376
.. _setuptools extras: http://packages.python.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies

0 commit comments

Comments
 (0)