uv
uv copied to clipboard
Add `uv init --from-project <path>` to import from other tools
As previously discussed for uv add -r pyproject.toml but without any of the controversy about what to do with extras. We can copy all of the dependencies as reported by the build backend.
I'll look into this tonight unless someone beats me to it.
I have no idea why I closed this.
Related: https://github.com/astral-sh/uv/issues/6164
Is this up for grabs?
Yes!
You can use SourceTreeResolver to get the metadata. But one challenge is... we probably need to preserve extras rather than resolving them. For example, if the user's pyproject.toml has:
[project.optional-dependencies]
foo = "bar"
Then in the project we create, we'd also want to create a foo extra with bar in it.
I'll take a look soon.
we'd also want to create a foo extra with bar in it.
This makes sense, a similar PR would then resolve #6164 right?
Yeah, it's possible that we want to skip #6164 for now since it brings up some confusing questions, like what does --extra mean in uv add --extra baz -r pyproject.toml. So let's start with support here in uv init.
What is needed to get this merged/released? It will help converting a lot of users from Poetry to UV, at least for companies which have large number of repo's.
Shameless plug (in case someone stumbles over this issue here and --from-project is still WIP): I wrote a script to migrate our Poetry monorepo project to uv (keeping versions pinned). I doubt it will work immediately on other projects, but could be a good start.
https://gist.github.com/mrcljx/8e99a7f9fb924a573416f4365ee15873
Any update on this?