@@ -520,87 +520,62 @@ paths in the project source tree relative to ``pyproject.toml`` to file(s)
520
520
containing licenses and other legal notices to be distributed with the package.
521
521
It corresponds to the ``License-File `` fields in the Core Metadata.
522
522
523
- Its value is a table, which if present MUST contain one of two optional,
524
- mutually exclusive subkeys, ``paths `` and ``globs ``; if both are specified,
525
- tools MUST raise an error. Both are arrays of strings; the ``paths `` subkey
526
- contains verbatim file paths, and the ``globs `` subkey valid glob patterns,
527
- which MUST be parsable by the ``glob `` `module <globmodule _>`__ in the
528
- Python standard library.
529
-
523
+ Its value is an array of strings which MUST contain valid glob patterns,
524
+ as specified below.
525
+ The glob patterns MAY contain special glob characters: ``* ``, ``? ``, ``** ``
526
+ and character ranges: ``[] ``, and tools MUST support them.
530
527
Path delimiters MUST be the forward slash character (``/ ``),
531
528
and parent directory indicators (``.. ``) MUST NOT be used.
532
529
Tools MUST assume that license file content is valid UTF-8 encoded text,
533
530
and SHOULD validate this and raise an error if it is not.
534
531
535
- If the ``paths `` subkey is a non-empty array, build tools:
536
-
537
- - MUST treat each value as a verbatim, literal file path, and
538
- MUST NOT treat them as glob patterns.
539
-
540
- - MUST include each listed file in all distribution archives.
541
-
542
- - MUST NOT match any additional license files beyond those explicitly
543
- statically specified by the user under the ``paths `` subkey.
532
+ Literal paths (e.g. ``LICENSE ``) are treated as valid globs which means they
533
+ can also be defined.
544
534
545
- - MUST list each file path under a ``License-File `` field in the Core Metadata.
535
+ To achieve better portability, the filenames to match should only contain
536
+ the alphanumeric characters, underscores (``_ ``), hyphens (``- ``)
537
+ and dots (``. `` - for extensions).
546
538
547
- - MUST raise an error if one or more paths do not correspond to a valid file
548
- in the project source that can be copied into the distribution archive.
549
-
550
- If the ``globs `` subkey is a non-empty array, build tools:
539
+ Build tools:
551
540
552
541
- MUST treat each value as a glob pattern, and MUST raise an error if the
553
542
pattern contains invalid glob syntax.
554
543
555
- - MUST include all files matched by at least one listed pattern in all
544
+ - MUST include all files matched by a listed pattern in all
556
545
distribution archives.
557
546
558
- - MAY exclude files matched by glob patterns that can be unambiguously
559
- determined to be backup, temporary, hidden, OS-generated or VCS-ignored.
560
-
561
547
- MUST list each matched file path under a ``License-File `` field in the
562
548
Core Metadata.
563
549
564
- - SHOULD issue a warning and MAY raise an error if no files are matched.
565
-
566
- - MAY issue a warning if any individual user-specified pattern
550
+ - MUST raise an error if any individual user-specified pattern
567
551
does not match at least one file.
568
552
569
- If the ``license-files `` key is present, and the `` paths `` or `` globs `` subkey
553
+ If the ``license-files `` key is present and
570
554
is set to a value of an empty array, then tools MUST NOT include any
571
555
license files and MUST NOT raise an error.
572
556
573
-
574
557
Examples of valid license files declaration:
575
558
576
559
.. code-block :: toml
577
560
578
561
[project]
579
- license-files = { globs = ["LICEN[CS]E*", "AUTHORS*"] }
562
+ license-files = ["LICEN[CS]E*", "AUTHORS*"]
580
563
581
564
[project]
582
- license-files.paths = ["licenses/LICENSE.MIT", "licenses/LICENSE.CC0"]
565
+ license-files = ["licenses/LICENSE.MIT", "licenses/LICENSE.CC0"]
583
566
584
567
[project]
585
- license-files = { paths = [] }
568
+ license-files = ["LICENSE.txt", "licenses/*"]
586
569
587
570
[project]
588
- license-files.globs = []
571
+ license-files = []
589
572
590
573
Examples of invalid license files declaration:
591
574
592
575
.. code-block :: toml
593
576
594
577
[project]
595
- license-files.globs = ["LICEN[CS]E*", "AUTHORS*"]
596
- license-files.paths = ["LICENSE.MIT"]
597
-
598
- Reason: license-files.paths and license-files.globs are mutually exclusive.
599
-
600
- .. code-block :: toml
601
-
602
- [project]
603
- license-files = { paths = ["..\LICENSE.MIT"] }
578
+ license-files = ["..\LICENSE.MIT"]
604
579
605
580
Reason: ``.. `` must not be used.
606
581
``\ `` is an invalid path delimiter, ``/ `` must be used.
@@ -609,7 +584,7 @@ Reason: ``..`` must not be used.
609
584
.. code-block :: toml
610
585
611
586
[project]
612
- license-files = { globs = ["LICEN{CSE*"] }
587
+ license-files = ["LICEN{CSE*"]
613
588
614
589
Reason: "LICEN{CSE*" is not a valid glob.
615
590
@@ -638,7 +613,7 @@ the ``license-files`` key instead.
638
613
If the specified license ``file `` is present in the source tree,
639
614
build tools SHOULD use it to fill the ``License-File `` field
640
615
in the core metadata, and MUST include the specified file
641
- as if it were specified in a ``license-file.paths `` field.
616
+ as if it were specified in a ``license-file `` field.
642
617
If the file does not exist at the specified path,
643
618
tools MUST raise an informative error as previously specified.
644
619
@@ -725,9 +700,9 @@ and license classifiers retain backwards compatibility. A removal is
725
700
left to a future PEP and a new version of the Core Metadata specification.
726
701
727
702
Specification of the new ``License-File `` Core Metadata field and adding the
728
- files in the distribution codifies the existing practices of many packaging
729
- tools. It is designed to be largely backwards-compatible with their existing
730
- use of that field. The new ``license-files `` key in the ``[project] `` table of
703
+ files in the distribution is designed to be largely backwards-compatible with
704
+ the existing use of that field in many packaging tools.
705
+ The new ``license-files `` key in the ``[project] `` table of
731
706
``pyproject.toml `` will only have an effect once users and tools adopt it.
732
707
733
708
This PEP specifies that license files should be placed in a dedicated
@@ -781,7 +756,8 @@ If an invalid ``License-Expression`` is used, the users will not be able
781
756
to publish their package to PyPI and an error message will help them
782
757
understand they need to use SPDX identifiers.
783
758
It will be possible to generate a distribution with incorrect license metadata,
784
- but not to publish one on PyPI or any other index server that enforces ``License-Expression `` validity.
759
+ but not to publish one on PyPI or any other index server that enforces
760
+ ``License-Expression `` validity.
785
761
For authors using the now-deprecated ``License `` field or license classifiers,
786
762
packaging tools may warn them and inform them of the replacement,
787
763
``License-Expression ``.
0 commit comments