Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions source/specifications/dependency-specifiers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,40 @@ Specification
Examples
--------

All features of the language shown with a name based lookup::
A dependency specifier showing all grammar features for a name based lookup::

requests [security,tests] >= 2.8.1, == 2.8.* ; python_version < "3.7"

A minimal URL based lookup::
A dependency specifier with a direct URL reference::

pip @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686

Optional whitespace can improve readability, as in ``pip ~= 23.1`` or
``resolvelib > 0.5, != 0.6.0``. The surrounding syntax depends on where the
dependency specifier is used.

In Core Metadata, dependency specifiers are values of
:ref:`Requires-Dist <core-metadata-requires-dist>` fields::

Requires-Dist: pip ~= 23.1
Requires-Dist: resolvelib > 0.5, != 0.6.0

In :file:`pyproject.toml`, they can be listed as strings, for example in
:ref:`project.dependencies <pyproject-toml-dependencies>`:

.. code-block:: toml

[project]
dependencies = [
"pip ~= 23.1",
"resolvelib > 0.5, != 0.6.0",
]

When passing a dependency specifier containing spaces on the command line,
quote the entire argument to preserve those spaces::

python -m pip install "pip ~= 23.1"

Concepts
--------

Expand Down Expand Up @@ -710,6 +736,8 @@ History
inadvertently retained from :pep:`508`
- July 2026: Explain that ``extra != "name"`` is not (properly) supported
(https://discuss.python.org/t/ban-negative-extras-for-extras-marker/108022/24)
- December 2026: Added examples showing dependency specifiers in metadata,
TOML configuration, and shell commands.


References
Expand Down