Skip to content

Conversation

@cbrnr
Copy link
Contributor

@cbrnr cbrnr commented Jul 16, 2025

uv-build is stable since 0.7.19 and supports PEP 639.


📚 Documentation preview 📚: https://python-packaging-user-guide--1880.org.readthedocs.build/en/1880/

@cbrnr
Copy link
Contributor Author

cbrnr commented Jul 18, 2025

I'm happy to add uv-build in the other locations mentioned in the linked issue. Is it OK in this PR, or should I open a new one?

auto-merge was automatically disabled July 18, 2025 06:58

Head branch was pushed to by a user without write access

@cbrnr
Copy link
Contributor Author

cbrnr commented Jul 18, 2025

I think it's easy enough to add this here.

Copy link
Contributor Author

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

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

I noticed that the table in writing-pyproject-toml.rst lists hatchling 1.27.0, whereas build-backend-tabs.rst contains 1.26.0. Should I fix this and if so, which one is the correct version?

@webknjaz
Copy link
Member

It's probably a good idea to separate such changes. Also, the broken link needs a separate PR too, to unblock this.

.. code-block:: toml
[build-system]
requires = ["uv_build >= 0.7.19, <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.

Upper limits are normally discouraged. What's the justification here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

We make (careful) breaking changes in the configuration format in 0.x releases, i.e. the configuration is only stable between >=0.x and <0.(x+1). Being a build backend, the usual concerns about upper bounds don't apply: The uv build backend is a binary with only a minimal Python shim, so older versions of the build backend will still work with newer Python versions. It has zero dependencies and is the only package in the build venv, so the aren't any conflicts the upper bound could cause.

Copy link
Member

Choose a reason for hiding this comment

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

Being a build backend, the usual concerns about upper bounds don't apply

That may be true upstream, but may present a challenge for the downstream maintainers as they often have a single version of a thing across their entire repositories (per distro release).

cc @befeleme @hroncok @mgorny any downstream insights on this?

Copy link

Choose a reason for hiding this comment

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

Please don't encourage upper bounds here. If you do, we'll and up in a position where we cannot update uv-build until we lift them. We won't be even able to test the packages with the new uv-build version in Fedora because of the pin.

Thanks @webknjaz for the mention.

Copy link
Member

Choose a reason for hiding this comment

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

Getting back to the specific question of this PR review (rather than the more general ones of showing exact version numbers and upper bounds in build dependencies):

  • mentioning uv-build is a reasonable change to make
  • the exact build backend version number problem is an existing issue, not new in this PR
  • the upper bound problem is an existing issue (due to flit), not new in this PR

That says to me that we should define a new PyPUG issue regarding the maintainability of those config snippets, and avoid having that concern block this PR.

I've created that issue here: #1886

@webknjaz Given the creation of the dedicated issue, are you happy to consider the question resolved for the purpose of adding uv-build to the example backends?

Copy link
Member

Choose a reason for hiding this comment

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

@ncoghlan I'm worried that accepting this as is would make the existing problem worse. And doing so is too impactful to just disregard it. The downstreams have expressed legitimate concern. Perhaps, we should address that issue you filed first so this PR wouldn't be as harmful?


@notatallshaw

because indeed they can not be kept up to date

I see regular PRs to update the setuptools lower bound, why would this be any different?

This is different because the example with setuptools is adding new features and when documenting them, the bound has to be updated for things to work. Inevitably.

But the same isn't happening when things break. Nobody comes in to update the guide documenting breakages and adjusting related bounds. And so there's no process for when this would be happening.

There should be a very obvious note leading to an explanation of why one should set version constraints with examples of how to write such version constraints and an advice to go check each project's own documentation regarding their versioning policies.

Every other build back end has lower bound version constraints, flit has lower and upper: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/

Why are you adding this requirement for uv_build when it's not been required to any other build back end?

Lower bounds are fine. Flit was mostly missed. It should also have an admonition explaining that upper bounds should be updated often. Maybe this admonition makes sense to have below all the examples, not selectively.

Copy link
Member

@ncoghlan ncoghlan Aug 4, 2025

Choose a reason for hiding this comment

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

I guess my view is that the PR itself isn't really making things worse, it's instead making this existing problem with the status quo more obvious.

Omitting the upper bounds creates an "old project releases may not build" scenario that affects potentially everyone, whereas including them has a more limited impact specifically on "unified build environment" scenarios (which could potentially be mitigated by build tooling changes, such as an option to ignore upper bounds in build dependency declarations and see if anything actually breaks with the newer build tool versions).

Copy link
Member

Choose a reason for hiding this comment

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

@mgorny @hroncok while merging this didn't exactly cater to your needs, I'd like to suggest discussing a systemic change to adding mentions of what's important for downstreams throughout PyPUG, if you're interested. Maybe, some admonitions linking to #1791 where relevant.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've filed a PR to automatically update the uv_build version range, to address the concern that the bounds would go stale: #1899

@johnthagen
Copy link

Another place it might be worth mentioning uv_build

@cbrnr
Copy link
Contributor Author

cbrnr commented Jul 21, 2025

@johnthagen that's already part of this PR.

@cbrnr
Copy link
Contributor Author

cbrnr commented Jul 21, 2025

@webknjaz the broken link works for me, can you re-run the failing test?

@webknjaz
Copy link
Member

Okay, I restarted it, but since this has been failing in multiple PRs, I don't expect it to succeed. Sometimes, different websites rate-limit or block access for crawlers or networks. In that case, they may open in a regular browser but break when on GitHub's network or just based on the User-Agent or similar.
This means sometimes having to suppress select URLs or configuring something..

@cbrnr
Copy link
Contributor Author

cbrnr commented Jul 22, 2025

You're probably right, but I think this problem should then be fixed in a different PR. One option would be to add this URL to linkcheck_ignore. See #1881.

@mgorny
Copy link
Contributor

mgorny commented Jul 30, 2025

And I think that the option of uv-build should include a warning that it introduces a dependency on the Rust compiler for pure Python packages, which is a limiting factor for downstream adoption.

@zanieb
Copy link
Contributor

zanieb commented Jul 30, 2025

And I think that the option of uv-build should include a warning that it introduces a dependency on the Rust compiler for pure Python packages, which is a limiting factor for downstream adoption.

It sounds pretty challenging to say this in a way that makes sense to the target audience here? It adds a dependency on the Rust compiler for people who are on uncommon systems or won't use prebuilt wheels of uv-build. I don't mean to trivialize the concern, but I don't really see why this belongs in the list of available build backends.

@konstin
Copy link
Contributor

konstin commented Jul 30, 2025

Also note that we're only building pure Python py3-none-any wheels, so it is possible to build a package on any supported linux/windows/mac/... machine and reuse on any other system. Similarly, users of those packages never have to build from source, as py3-none-any wheels exist on the index.

Please see astral-sh/uv#3957 (comment), where we're addressing a lot of the common concerns there.

Copy link
Member

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

LGTM, but I'll give @webknjaz time to consider my suggestion on the version number/bounds maintainability question.

@webknjaz webknjaz enabled auto-merge August 8, 2025 21:32
@webknjaz
Copy link
Member

webknjaz commented Aug 8, 2025

Alright, let's give it a go.

@webknjaz webknjaz added this pull request to the merge queue Aug 8, 2025
Merged via the queue into pypa:main with commit 4e2c714 Aug 8, 2025
7 checks passed
konstin added a commit to konstin/packaging.python.org that referenced this pull request Aug 25, 2025
In pypa#1880, the concern was raised that the uv_build upper bound in the docs will go stale. This PR adds a GitHub Actions workflow that automatically updates the version daily with the latest uv(-build) version.

I tested this change on my fork, but I unfortunately can't test this in pypa/packaging.python.org itself.
konstin added a commit to konstin/packaging.python.org that referenced this pull request Aug 25, 2025
In pypa#1880, the concern was raised that the uv_build upper bound in the docs will go stale. This PR adds a GitHub Actions workflow that automatically updates the version daily with the latest uv(-build) version.

I tested this change on my fork, but I unfortunately can't test this in pypa/packaging.python.org itself.
konstin added a commit to konstin/packaging.python.org that referenced this pull request Aug 25, 2025
In pypa#1880, the concern was raised that the uv_build upper bound in the docs will go stale. This PR adds a GitHub Actions workflow that automatically updates the version daily with the latest uv(-build) version.

I tested this change on my fork, but I unfortunately can't test this in pypa/packaging.python.org itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.