-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose uv build
build frontend (pypa/build
replacement)
#1510
Comments
Correct me if I'm wrong but I think those tools only interact with |
We're already a build frontend, I think. We do all of this to build source distributions for users. We don't expose it as a top-level command, but it would make a lot of sense to do so. Just for fun, there's also this #895 Regarding a Python API — probably not anytime soon since it introduces more complexity around backwards compatibility. |
pypa/build
replacement)
virtualenv has a very, very simple Python interface based on the CLI: cmd = [str(path), '--no-setuptools', '--no-wheel', '--activators', '']
result = virtualenv.cli_run(cmd, setup_logging=False)
executable = str(result.creator.exe)
script_dir = str(result.creator.script_dir) I think the main reason it exists to skip the python process startup cost, which uv already skips. The only thing you'd need, actually, is a structured output option (say json?) that describes what it just created, then |
What about the CLI? Here's how build works, and I'd recommend the same thing for
Key options:
Footnotes
|
Thanks for pushing this forward Henry. That makes sense to me, roughly. Personally, I'd be happy to review an experimental addition of this interface. We'll need to talk as a team though to figure out where this fits on our roadmap. |
We have |
The nice thing about "build" is it could be just like "pip", a copy of the PyPA tool that everyone is already familiar with. And it's nicely low level, rather than a higher level concept like "publish". But the name is pretty general. I assume there should be a way to build SDists in the future too? Also, I'd not use It's great that it can take SDists, but I'd name the positional parameter "SOURCE" since if you are building an SDist, it doesn't make sense, and even building a wheel, I think SOURCE would be fine for and SDist, but also include pointing at a source. Also, I'd recommend emulating build's output, which is excellent and a good balance of detail vs. noise. FYI, uv-dev builds builds's wheel in 571ms. |
Is this a duplicate of #920? |
Kind of, though that refers to “pip build”, which isn’t a thing. And I’m specifically interested in mimicking pypa/build as closely as reasonable with “uv build”, just like “uv pip” and “uv venv”. |
I think this is a duplicate of #920 — it's the same idea of exposing our PEP 517 build frontend, the name of the command is up for consideration still. |
Echoing an earlier comment, the output from |
What I'd like to see from |
pypa/build
replacement)uv build
build frontend (pypa/build
replacement)
Modifying the title to help with search as we're getting other requests. |
One thing that'd be incredibly useful, which pypa/build does not currently support, is being able to turn an sdist into a wheel. Were |
TIL pypa/build#311 |
I have this mostly working. |
It's good motivation to add support for streaming the build output though. Feels essential! |
Ok, I have the build output working in #6903, but unsure whether to show it by default or only with |
My intuition is that I basically always would want it when running uv build.
…On Sat, Aug 31, 2024 at 7:56 PM Charlie Marsh ***@***.***> wrote:
Ok, I have the build output working in #6903
<#6903>, but unsure whether to show
it by default or only with --verbose.
—
Reply to this email directly, view it on GitHub
<#1510 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBEN3SRA2NZFPNZOELLZUJJ2RAVCNFSM6AAAAABDMJW74SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGA3TKMZTGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
Have that part working here: #6912 |
I'm curious if replacing
pypa/build
is something being considered. It would be a good idea, I think, to avoid implementingpip wheel
, and instead focus on build. I think most of the components are already here - the ability to make temporary virtual environments is the key one. In fact, the ability to build (pip install .
though config-settings are missing #1460) is here too. The procedure is simple, though you do need a Python interpreter to call the PEP 517 hooks, it's mostly making a venv, adding packagers, running a hook if it exists and adding those packages, then calling the build backend hook. There are a total of 5 hooks (wheel, sdist, requires for wheel and sdist, and a metadata hook). You can look at pypa/build, there's not that much code there, really. I'd be able to help a bit if needed.The other direction would also be very, very interesting - build uses
venv
by default, but it can switch tovirtualenv
if that's installed. Is there a plan to provide a Python API foruv virtualenv
? Then build could just switch touv
if that was installed, getting a speedup (I expect). Same would be true for all the other tooling built onvenv
andvirtualenv
, like nox, tox, hatch, pdm, etc., I expect.The text was updated successfully, but these errors were encountered: