From e2a06f6889535538c39b548e5fb3c0954070f9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Brunat?= Date: Tue, 18 Aug 2026 15:35:46 +0200 Subject: [PATCH] build: switch the build backend from hatchling to uv_build The project already uses uv for environments, dependencies, building and publishing; uv_build removes the one remaining build-time tool and is version-aligned with uv itself. Two settings have to be explicit, and one of them prevents a silent regression: - module-name, because the distribution is clevercloud-sdk while the module is clever_cloud, which uv_build cannot derive from the name. - license-files, because hatchling shipped LICENSE in the wheel on its own and uv_build does not. Apache-2.0 requires redistributing the licence with the work, so without this the wheel would quietly stop carrying it. Verified on the produced artifacts: twine check passes on both distributions, the wheel still ships py.typed and now LICENSE, and the 236 tests pass against the built wheel installed in an isolated environment. Note for reviewers: uv_build rewrites pyproject.toml inside the sdist as normalised TOML, without comments, and keeps the original as pyproject.toml.orig. Metadata-Version is 2.4 instead of hatchling's 2.5. Neither affects installation. --- pyproject.toml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7b1a118..3d7e779 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["uv_build>=0.12,<0.13"] +build-backend = "uv_build" [project] name = "clevercloud-sdk" @@ -8,6 +8,9 @@ version = "0.2.0" description = "Python SDK for Clever Cloud" readme = "README.md" license = "Apache-2.0" +# Explicit: unlike hatchling, uv_build does not ship the licence file unless +# it is listed, and Apache-2.0 requires redistributing it with the work. +license-files = ["LICENSE"] requires-python = ">=3.11" authors = [ { name = "David LEGRAND", email = "david.legrand@clever.cloud" } @@ -44,15 +47,11 @@ Documentation = "https://github.com/CleverCloud/clevercloud-sdk-python#readme" Repository = "https://github.com/CleverCloud/clevercloud-sdk-python" Issues = "https://github.com/CleverCloud/clevercloud-sdk-python/issues" -[tool.hatch.build.targets.sdist] -include = [ - "/src", - "/tests", - "/CHANGELOG.md", -] - -[tool.hatch.build.targets.wheel] -packages = ["src/clever_cloud"] +[tool.uv.build-backend] +# The distribution is named clevercloud-sdk but the module is clever_cloud, +# which uv_build cannot derive from the project name. +module-name = "clever_cloud" +source-include = ["tests/**", "CHANGELOG.md"] [tool.pytest.ini_options] testpaths = ["tests"]