Skip to content

Commit a8f6ba6

Browse files
committed
Update the Writing pyproject.toml guide with new licensing guidelines
1 parent cdf84ba commit a8f6ba6

File tree

1 file changed

+47
-14
lines changed

1 file changed

+47
-14
lines changed

source/guides/writing-pyproject-toml.rst

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,26 +324,59 @@ You can also specify the format explicitly, like this:
324324
``license``
325325
-----------
326326

327-
This can take two forms. You can put your license in a file, typically
328-
``LICENSE`` or ``LICENSE.txt``, and link that file here:
327+
This is a valid :term:`SPDX license expression <License Expression>` consisting
328+
of one or more :term:`license identifiers <License Identifier>`.
329+
The full license list is available at the
330+
`SPDX license list page <spdxlicenselist_>`_. The supported list version is
331+
3.17 or any later compatible one.
329332

330333
.. code-block:: toml
331334
332335
[project]
333-
license = {file = "LICENSE"}
336+
license = "GPL-3.0-or-later"
337+
# or
338+
license = "MIT AND (Apache-2.0 OR BSD-2-Clause)"
334339
335-
or you can write the name of the license:
340+
As a general rule, it is a good idea to use a standard, well-known
341+
license, both to avoid confusion and because some organizations avoid software
342+
whose license is unapproved.
343+
344+
If your project is licensed with a license that doesn't have an existing SPDX
345+
identifier, you can create a custom one in format ``LicenseRef-[idstring]``.
346+
The custom identifiers must follow the SPDX specification,
347+
`clause 10.1 <spdxcustomids_>`_ of the version 2.2 or any later compatible one.
336348

337349
.. code-block:: toml
338350
339351
[project]
340-
license = {text = "MIT License"}
352+
license = "LicenseRef-My-Custom-License"
341353
342-
If you are using a standard, well-known license, it is not necessary to use this
343-
field. Instead, you should use one of the :ref:`classifiers` starting with ``License
344-
::``. (As a general rule, it is a good idea to use a standard, well-known
345-
license, both to avoid confusion and because some organizations avoid software
346-
whose license is unapproved.)
354+
355+
``license-files``
356+
-----------------
357+
358+
This is a list of license files and files containing other legal
359+
information you want to distribute with your package.
360+
361+
.. code-block:: toml
362+
363+
[project]
364+
license-files = ["LICEN[CS]E*", "vendored/licenses/*.txt", "AUTHORS.md"]
365+
366+
The glob patterns must follow the specification:
367+
368+
- Alphanumeric characters, underscores (``_``), hyphens (``-``) and dots (``.``)
369+
will be matched verbatim.
370+
- Special characters: ``*``, ``?``, ``**`` and character ranges: [] are supported.
371+
- Path delimiters must be the forward slash character (``/``).
372+
- Patterns are relative to the directory containing :file:`pyproject.toml`, and
373+
thus may not start with a slash character.
374+
- Parent directory indicators (``..``) must not be used.
375+
- Each glob must match at least one file.
376+
377+
Literal paths are valid globs.
378+
Any characters or character sequences not covered by this specification are
379+
invalid.
347380

348381

349382
``keywords``
@@ -379,9 +412,6 @@ A list of PyPI classifiers that apply to your project. Check the
379412
"Intended Audience :: Developers",
380413
"Topic :: Software Development :: Build Tools",
381414
382-
# Pick your license as you wish (see also "license" above)
383-
"License :: OSI Approved :: MIT License",
384-
385415
# Specify the Python versions you support here.
386416
"Programming Language :: Python :: 3",
387417
"Programming Language :: Python :: 3.6",
@@ -498,7 +528,8 @@ A full example
498528
]
499529
description = "Lovely Spam! Wonderful Spam!"
500530
readme = "README.rst"
501-
license = {file = "LICENSE.txt"}
531+
license = "MIT"
532+
license-files = ["LICEN[CS]E.*"]
502533
keywords = ["egg", "bacon", "sausage", "tomatoes", "Lobster Thermidor"]
503534
classifiers = [
504535
"Development Status :: 4 - Beta",
@@ -545,3 +576,5 @@ A full example
545576
.. _pytest: https://pytest.org
546577
.. _pygments: https://pygments.org
547578
.. _rest: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
579+
.. _spdxcustomids: https://spdx.github.io/spdx-spec/v2.2.2/other-licensing-information-detected/
580+
.. _spdxlicenselist: https://spdx.org/licenses/

0 commit comments

Comments
 (0)