build: switch the build backend from hatchling to uv_build - #6
Merged
Conversation
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.
sebartyr
force-pushed
the
build/uv-build-backend
branch
from
August 18, 2026 13:38
a792299 to
e2a06f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The project already uses
uvfor environments, dependencies, building and publishing.uv_buildremoves the one remaining build-time tool and is version-aligned withuvitself (both 0.12.5 here).What it needs
Two settings must be explicit, and one of them prevents a silent regression:
module-name = "clever_cloud"— the distribution isclevercloud-sdkbut the module isclever_cloud, whichuv_buildcannot derive from the project name. Without it the build fails outright, so this one is loud.license-files = ["LICENSE"]— hatchling shippedLICENSEin the wheel on its own;uv_builddoes not. Apache-2.0 requires redistributing the licence with the work, so without this line the wheel would quietly stop carrying it. I only caught this by diffing the two wheels file by file.Verified on the produced artifacts
uvx twine checkpasses on both distributions.clever_cloud/py.typed, and nowdist-info/licenses/LICENSEagain.uv run --isolated --no-project --with dist/*.whl), not just against the source tree.requires-python, same URLs and keywords.Two behaviours worth knowing
uv_buildrewritespyproject.tomlinside the sdist as normalised TOML, dropping every comment, and keeps the original aspyproject.toml.orig. So the sdist carries two copies of the file. No effect on installation, but it is surprising the first time.Metadata-Versionis 2.4 rather than hatchling's 2.5. PyPI accepts both.Timing
I would not rebuild the
v0.2.0artifacts with this. The tag and the GitHub release already carry hatchling-built distributions that have been checked, and re-tagging a published tag is worse than a one-version backend inconsistency. Publish 0.2.0 as it stands; this takes effect from the next version.Conflict
Touches the same
pyproject.tomlblock as #5, which addsCHANGELOG.mdto the sdist. Resolution is trivial — the[tool.uv.build-backend]block here replaces the[tool.hatch.build.targets.*]blocks entirely, andsource-includealready listsCHANGELOG.md. Merge #5 first and I will rebase, or merge this one first and #5 drops that hunk.