From 4c89f78ddb16fbf326d182b716042c9218861444 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 10 Nov 2024 09:54:18 -0500 Subject: [PATCH] Fix breaking changes --- backend/src/hatchling/dep/__init__.py | 0 backend/src/hatchling/dep/core.py | 1 + backend/src/hatchling/metadata/core.py | 3 +++ docs/config/metadata.md | 20 +++++--------------- docs/history/hatchling.md | 9 +++++++++ 5 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 backend/src/hatchling/dep/__init__.py create mode 100644 backend/src/hatchling/dep/core.py diff --git a/backend/src/hatchling/dep/__init__.py b/backend/src/hatchling/dep/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/backend/src/hatchling/dep/core.py b/backend/src/hatchling/dep/core.py new file mode 100644 index 000000000..a986a1e02 --- /dev/null +++ b/backend/src/hatchling/dep/core.py @@ -0,0 +1 @@ +from hatchling.cli.dep.core import dependencies_in_sync # noqa: F401 diff --git a/backend/src/hatchling/metadata/core.py b/backend/src/hatchling/metadata/core.py index 23bba1905..88ed55775 100644 --- a/backend/src/hatchling/metadata/core.py +++ b/backend/src/hatchling/metadata/core.py @@ -742,6 +742,9 @@ def license_files(self) -> list[str]: 'listed in field `project.dynamic`' ) raise ValueError(message) + + if isinstance(globs, dict): + globs = globs.get('globs', globs.get('paths', [])) else: globs = ['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*'] diff --git a/docs/config/metadata.md b/docs/config/metadata.md index 71533e66a..c7b415792 100644 --- a/docs/config/metadata.md +++ b/docs/config/metadata.md @@ -113,21 +113,11 @@ For more information, see [PEP 639][]. === "Files" - === "Paths" - - ```toml - [project] - ... - license-files = { paths = ["LICENSE.txt"] } - ``` - - === "Globs" - - ```toml - [project] - ... - license-files = { globs = ["LICENSES/*"] } - ``` + ```toml + [project] + ... + license-files = ["LICENSES/*"] + ``` ## Ownership diff --git a/docs/history/hatchling.md b/docs/history/hatchling.md index 8e3bd4920..095238455 100644 --- a/docs/history/hatchling.md +++ b/docs/history/hatchling.md @@ -8,8 +8,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased +***Fixed:*** + +- Add backward compatibility for the old `license-files` metadata field +- Support an old import path that is still used by some consumers like Hatch + ## [1.26.0](https://github.com/pypa/hatch/releases/tag/hatchling-v1.26.0) - 2024-11-10 ## {: #hatchling-v1.26.0 } +***Changed:*** + +- The `license-files` metadata field has been updated to the latest spec and is now just an array of glob patterns + ***Added:*** - Support version 2.4 of core metadata for the `wheel` and `sdist` targets