Skip to content

Commit 92c3d8b

Browse files
committed
Update the Writing pyproject.toml guide with new licensing guidelines
1 parent 11a07bf commit 92c3d8b

File tree

1 file changed

+44
-14
lines changed

1 file changed

+44
-14
lines changed

source/guides/writing-pyproject-toml.rst

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,26 +324,56 @@ 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`, the leading
373+
slash character is not allowed.
374+
- Parent directory indicators (``..``) must not be used.
375+
376+
Literal paths are treated as valid globs.
347377

348378

349379
``keywords``
@@ -379,9 +409,6 @@ A list of PyPI classifiers that apply to your project. Check the
379409
"Intended Audience :: Developers",
380410
"Topic :: Software Development :: Build Tools",
381411
382-
# Pick your license as you wish (see also "license" above)
383-
"License :: OSI Approved :: MIT License",
384-
385412
# Specify the Python versions you support here.
386413
"Programming Language :: Python :: 3",
387414
"Programming Language :: Python :: 3.6",
@@ -498,7 +525,8 @@ A full example
498525
]
499526
description = "Lovely Spam! Wonderful Spam!"
500527
readme = "README.rst"
501-
license = {file = "LICENSE.txt"}
528+
license = "MIT"
529+
license-files = ["LICENSE.*"]
502530
keywords = ["egg", "bacon", "sausage", "tomatoes", "Lobster Thermidor"]
503531
classifiers = [
504532
"Development Status :: 4 - Beta",
@@ -545,3 +573,5 @@ A full example
545573
.. _pytest: https://pytest.org
546574
.. _pygments: https://pygments.org
547575
.. _rest: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
576+
.. _spdxcustomids: https://spdx.github.io/spdx-spec/v2.2.2/other-licensing-information-detected/
577+
.. _spdxlicenselist: https://spdx.org/licenses/

0 commit comments

Comments
 (0)