Skip to content
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

Add uv init --from-project <path> to import from other tools #6277

Open
zanieb opened this issue Aug 20, 2024 · 10 comments · May be fixed by #6374
Open

Add uv init --from-project <path> to import from other tools #6277

zanieb opened this issue Aug 20, 2024 · 10 comments · May be fixed by #6374
Labels
cli Related to the command line interface enhancement New feature or improvement to existing functionality

Comments

@zanieb
Copy link
Member

zanieb commented Aug 20, 2024

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.

@zanieb zanieb added enhancement New feature or improvement to existing functionality cli Related to the command line interface labels Aug 20, 2024
@charliermarsh
Copy link
Member

I'll look into this tonight unless someone beats me to it.

@charliermarsh
Copy link
Member

I have no idea why I closed this.

@charliermarsh
Copy link
Member

Related: #6164

@blueraft
Copy link
Contributor

Is this up for grabs?

@charliermarsh
Copy link
Member

Yes!

@charliermarsh
Copy link
Member

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.

@blueraft
Copy link
Contributor

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?

@charliermarsh
Copy link
Member

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.

@mrijken
Copy link

mrijken commented Sep 2, 2024

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.

@mrcljx
Copy link

mrcljx commented Sep 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants