Thanks for providing an example. It’s much clearer to me what you’re saying now.
But what I don’t understand is how I’d install this project using pip. I think your answer is that you can’t - which is where I have a problem, because if a project isn’t installable using a standards-compliant installer, then I don’t think we should be discussing how the standards record the installation of that project.
I tried cloning your project and running pip wheel .
, and I got the following error:
❯ pip wheel .
Processing c:\users\gustav\appdata\local\temp\tmp-1\project-in-git
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of project-in-git to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement prebuilt (from project-in-git) (from versions: none)
ERROR: No matching distribution found for prebuilt
The same if I try to do pip wheel <sdist>
on the sdist produced by uv build
.
So I’m sorry, but I really don’t see this as something we should support. Our packaging standards are explicitly about avoiding tool lock-in, and source distributions (or project source trees) that can only be built with a specific tool are something that IMO we should be strongly discouraging. How would someone publish this sdist on PyPI, for example?
If we want this type of workflow (and I completely understand that it’s a reasonable suggestion) then we should be looking at how we capture the sort of dependency on a vendored wheel that your example uses in the metadata standards first. Once such projects are buildable using any standards-compliant tool, then we can look at whether we need any changes to direct_url.json
(and at that point, we may well not, as the sdist’s metadata might handle it just fine on its own).
If you really don’t want to standardise this workflow, then I think what you really need is a way of storing tool-specific metadata in the installed project’s .dist-info
directory. That’s been discussed on a number of occasions, but no-one has ever been motivated to take it any further. But I’d be concerned if your motivation for doing so was simply to avoid facing the issue that uv
seems capable of producing unpublishable sdists, without warning the user of that fact.
I would be very interested to know if the support in hatch
and uv
has the same problem, of ending up with a sdist that cannot be built with pip
or build
. @frostming @ofek - is this purely a uv issue, or do you have the same problem?