Skip to content

Commit f783620

Browse files
takluyverJon Wayne Parrott
authored andcommitted
Note which fields can be used with environment markers (pypa#416)
From PEP 345 Closes pypagh-409
1 parent db6d5ab commit f783620

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

source/specifications/core-metadata.rst

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ Classifier (multiple use)
357357
Each entry is a string giving a single classification value
358358
for the distribution. Classifiers are described in PEP 301 [3]_.
359359

360+
This field may be followed by an environment marker after a semicolon.
361+
360362
Examples::
361363

362364
Classifier: Development Status :: 4 - Beta
@@ -371,21 +373,33 @@ Requires-Dist (multiple use)
371373
Each entry contains a string naming some other distutils
372374
project required by this distribution.
373375

374-
The format of a requirement string is identical to that of a
375-
distutils project name (e.g., as found in the ``Name:`` field.
376-
optionally followed by a version declaration within parentheses.
376+
The format of a requirement string contains from one to four parts:
377+
378+
* A project name, in the same format as the ``Name:`` field.
379+
The only mandatory part.
380+
* A comma-separated list of 'extra' names. These are defined by
381+
the required project, referring to specific features which may
382+
need extra dependencies.
383+
* A version specifier. Tools parsing the format should accept optional
384+
parentheses around this, but tools generating it should not use
385+
parentheses.
386+
* An environment marker after a semicolon. This means that the
387+
requirement is only needed in the specified conditions.
377388

378-
The distutils project names should correspond to names as found
389+
See :pep:`508` for full details of the allowed format.
390+
391+
The project names should correspond to names as found
379392
on the `Python Package Index`_.
380393

381-
Version declarations must follow the rules described in
394+
Version specifiers must follow the rules described in
382395
:doc:`version-specifiers`.
383396

384397
Examples::
385398

386399
Requires-Dist: pkginfo
387400
Requires-Dist: PasteDeploy
388401
Requires-Dist: zope.interface (>3.5.0)
402+
Requires-Dist: pywin32 >1.0; sys_platform == 'win32'
389403

390404

391405
Provides-Dist (multiple use)
@@ -417,11 +431,13 @@ A version declaration may be supplied and must follow the rules described
417431
in :doc:`version-specifiers`. The distribution's version number will be implied
418432
if none is specified.
419433

434+
This field may be followed by an environment marker after a semicolon.
435+
420436
Examples::
421437

422438
Provides-Dist: OtherProject
423439
Provides-Dist: AnotherProject (3.4)
424-
Provides-Dist: virtual_package
440+
Provides-Dist: virtual_package; python_version >= "3.4"
425441

426442

427443
Obsoletes-Dist (multiple use)
@@ -436,6 +452,8 @@ should not be installed at the same time.
436452
Version declarations can be supplied. Version numbers must be in the
437453
format specified in :doc:`version-specifiers`.
438454

455+
This field may be followed by an environment marker after a semicolon.
456+
439457
The most common use of this field will be in case a project name
440458
changes, e.g. Gorgon 2.3 gets subsumed into Torqued Python 1.0.
441459
When you install Torqued Python, the Gorgon distribution should be
@@ -445,6 +463,7 @@ Examples::
445463

446464
Obsoletes-Dist: Gorgon
447465
Obsoletes-Dist: OtherProject (<3.0)
466+
Obsoletes-Dist: Foo; os_name == "posix"
448467

449468

450469
Requires-Python
@@ -458,11 +477,14 @@ picking which version of a project to install.
458477

459478
The value must be in the format specified in :doc:`version-specifiers`.
460479

480+
This field may be followed by an environment marker after a semicolon.
481+
461482
Examples::
462483

463484
Requires-Python: >=3
464485
Requires-Python: >2.6,!=3.0.*,!=3.1.*
465486
Requires-Python: ~=2.6
487+
Requires-Python: >=3; sys_platform == 'win32'
466488

467489

468490
Requires-External (multiple use)
@@ -479,6 +501,8 @@ The format of a requirement string is a name of an external
479501
dependency, optionally followed by a version declaration within
480502
parentheses.
481503

504+
This field may be followed by an environment marker after a semicolon.
505+
482506
Because they refer to non-Python software releases, version numbers
483507
for this field are **not** required to conform to the format
484508
specified in PEP 440: they should correspond to the
@@ -490,6 +514,7 @@ Examples::
490514

491515
Requires-External: C
492516
Requires-External: libpng (>=1.5)
517+
Requires-External: make; sys_platform != "win32"
493518

494519

495520
Project-URL (multiple-use)

0 commit comments

Comments
 (0)