Add an option to add a local dependency also as workspace member for `uv add`
#9634 aperta il 4 dic 2024
Metriche repository
- Star
- (84.934 star)
- Metriche merge PR
- (Merge medio 7g 16h) (259 PR mergiate in 30 g)
Descrizione
I'm working with a bit of an unorthodox setup: I have a bunch of different, independent projects. Some of these projects are utilities meant to be used by other projects, and I found that the easiest way to manage this setup is to make the "main" projects workspaces that depend on the utilities packages, which are also members of these workspaces. Something like this:
main_folder
- workspace A (members and dependencies: utility A, utility B)
- workspace B (members and dependencies: utility A)
- workspace C (members and dependencies: utility B)
- utility A (an uv project)
- utility B (an uv project)
I know that workspaces are supposed to contain in their folders their members, but this setup lets me deal with uv sync/build/etc without repeating the command for the utilities projects by using --all-packages. Also, I can easily copy pyproject.toml and uv.lock of a workspace and its utilities, and call uv sync --no-install-workspace to easily install all the dependencies of the entire workspace in a Docker container, without installing the projects and utilities themselves.
That said, I can add a local dependency in the CLI using uv add /path/to/package, but I then have to manually edit the pyproject.toml file to make that package also a workspace member.
Would it make sense to have some kind of option, something like --as-member, so that uv add --as-member /path/to/package would add package as a dependency and as a workspace member?