astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
23.26k stars 669 forks source link

Consider adding workspace members as sources in `uv init` #5388

Open zanieb opened 2 months ago

zanieb commented 2 months ago

Initializing as workspace member adds it to the root package workspace members but does not add it as a dependency, e.g.:

❯ uv init
❯ uv init foo
Adding `foo` as member of workspace `/Users/zb/workspace/example`
Initialized project `foo` at `/Users/zb/workspace/example/foo`
❯ cat pyproject.toml
[project]
name = "example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[tool.uv]
dev-dependencies = []

[tool.uv.workspace]
members = ["foo"]

uv add will do so:

❯ uv add foo
❯ cat pyproject.toml
[project]
name = "example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "foo",
]

[tool.uv]
dev-dependencies = []

[tool.uv.workspace]
members = ["foo"]

[tool.uv.sources]
foo = { workspace = true }

We should something like:

charliermarsh commented 2 months ago

Not in love with a toggle for this, let's just pick a good default IMO. What does Cargo do?

charliermarsh commented 1 month ago

I think it makes sense to add it as a dep here.

jakubkunert commented 1 week ago

I would like to do it, but I need some hint or consultation here.