Skip to content

Conversation

intgr
Copy link
Collaborator

@intgr intgr commented Sep 30, 2025

Solving follow-ups from #2846 comments.

  • Switched build system hatchling -> uv_build
  • Removed useless twine check from build-and-check CI job

* Switched `hatchling` -> `uv_build`
* Removed useless `twine check` from `build-and-check` CI job
@intgr intgr requested a review from ngnpope September 30, 2025 17:34
@intgr
Copy link
Collaborator Author

intgr commented Sep 30, 2025

Similar to djangorestframework-stubs, there are mostly frivolous differences in .whl file contents, comparing python3 -m build before with uv build after.

Such as METADATA file different order of fields; package name casefolding; whether single quotes or double quotes are used, etc.

Diffs: https://gist.github.com/intgr/dd8c503bc93148eef1f1e8632fff850e

@@ -1,7 +1,3 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never liked that this was at the top of the file; moved to below package metadata.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also lean on https://github.com/tox-dev/pyproject-fmt/ for a consistent sort

[tool.hatch.build]
packages = ["django_stubs_ext"]
[build-system]
requires = ["uv_build>=0.8.22,<0.9.0"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to be this specific? Will "uv_build>=0.8" work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is recommended by official docs https://docs.astral.sh/uv/concepts/build-backend/#using-the-uv-build-backend

I guess patchlevel versions may contain fixes, I see no reason to allow downgrading to more buggy versions given that we haven't tested with them.

uv build ext/
- name: Check package metadata
run: |
uvx twine check --strict dist/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does uv has an alternative with a dry-run?

Copy link
Member

@ngnpope ngnpope Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2846 (comment) - twine check is only making sure that rST is valid in the long description, but we're using markdown.

Copy link
Contributor

@UnknownPlatypus UnknownPlatypus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, seem good to me

@sobolevn sobolevn merged commit 52128a8 into typeddjango:master Oct 1, 2025
39 checks passed
@intgr intgr deleted the switch-to-uv-build branch October 1, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants