From 2db63257be966c2bed232c22b7228affdd29a344 Mon Sep 17 00:00:00 2001 From: Liam Keegan Date: Wed, 20 May 2026 09:28:15 +0200 Subject: [PATCH] Update slides and example code with PEP639 license info --- calculate-liam/pyproject.toml | 5 +++-- slides/index.md | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/calculate-liam/pyproject.toml b/calculate-liam/pyproject.toml index 1898f78..cce7323 100644 --- a/calculate-liam/pyproject.toml +++ b/calculate-liam/pyproject.toml @@ -4,17 +4,18 @@ build-backend = "hatchling.build" [project] name = "calculate-liam" -version = "0.0.8" +version = "0.0.9" dependencies = ["click", "numpy"] authors = [ { name="Liam Keegan", email="liam@keegan.ch" }, ] +license = "MIT" +license-files = ["LICENSE.md"] description = "An example package from the SSC Python Packaging course" readme = "README.md" requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] diff --git a/slides/index.md b/slides/index.md index 887ab96..d419904 100644 --- a/slides/index.md +++ b/slides/index.md @@ -606,7 +606,7 @@ pip install -e . … pyproject.toml # defines how to install the package README.md # all projects should have a readme - LICENSE # all projects should have a license + LICENSE.md # all projects should have a license ``` --- @@ -748,38 +748,35 @@ authors = [ ] description = "A simple package to flip a coin or roll dice" readme = "README.md" -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", -] +license = "MIT" +license-files = ["LICENSE.md"] ... ``` --- -# License in pyproject.toml +# Licenses in pyproject.toml -We specified our license using a classifier (see [pypi.org/classifiers](https://pypi.org/classifiers/)): +We specified our license using the [SPDX identifier](https://spdx.org/licenses/) "MIT" and pointed to the license file: ```toml -[project] -classifiers = [..., "License :: OSI Approved :: MIT License", ...] +license = "MIT" +license-files = ["LICENSE.md"] ``` -This is the preferred method if there is a classifier available for your license. +This is the current recommended way to specify the license (see [PEP 639](https://peps.python.org/pep-0639)). -Alternatively you can instead point to your license file: +Here are some older (deprecated) alternatives you may see: ```toml -[project] -license = { file = "LICENSE.txt" } +classifiers = [..., "License :: OSI Approved :: MIT License", ...] ``` -Or simply provide the license as plain text: +```toml +license = { file = "LICENSE.txt" } +``` ```toml -[project] license = { text = "MIT" } ```