Skip to content

Commit 1611454

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

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

source/guides/writing-pyproject-toml.rst

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,26 +324,55 @@ 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+
- Alphanumeric characters, underscores (_), hyphens (-) and dots (.)
368+
will be matched verbatim.
369+
- Special characters: *, ?, ** and character ranges: [] are supported.
370+
- Path delimiters must be the forward slash character (/).
371+
- Patterns are relative to the directory containing pyproject.toml, the leading
372+
slash character is not allowed.
373+
- Parent directory indicators (..) must not be used.
374+
375+
Literal paths are treated as valid globs.
347376

348377

349378
``keywords``
@@ -379,9 +408,6 @@ A list of PyPI classifiers that apply to your project. Check the
379408
"Intended Audience :: Developers",
380409
"Topic :: Software Development :: Build Tools",
381410
382-
# Pick your license as you wish (see also "license" above)
383-
"License :: OSI Approved :: MIT License",
384-
385411
# Specify the Python versions you support here.
386412
"Programming Language :: Python :: 3",
387413
"Programming Language :: Python :: 3.6",
@@ -498,7 +524,8 @@ A full example
498524
]
499525
description = "Lovely Spam! Wonderful Spam!"
500526
readme = "README.rst"
501-
license = {file = "LICENSE.txt"}
527+
license = "MIT"
528+
license-files = ["LICENSE.*"]
502529
keywords = ["egg", "bacon", "sausage", "tomatoes", "Lobster Thermidor"]
503530
classifiers = [
504531
"Development Status :: 4 - Beta",
@@ -545,3 +572,5 @@ A full example
545572
.. _pytest: https://pytest.org
546573
.. _pygments: https://pygments.org
547574
.. _rest: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
575+
.. _spdxcustomids: https://spdx.github.io/spdx-spec/v2.2.2/other-licensing-information-detected/
576+
.. _spdxlicenselist: https://spdx.org/licenses/

0 commit comments

Comments
 (0)