astral-sh/uv

Consider adding workspace members as sources in `uv init`

Open

#5388 aperta il 24 lug 2024

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Rust (3111 fork)batch import
cligood first issueprojects

Metriche repository

Star
 (84.934 star)
Metriche merge PR
 (Merge medio 7g 16h) (259 PR mergiate in 30 g)

Descrizione

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:

  • Add a toggle to control adding to the current workspace in a single invocation
  • Determine the default behavior
  • If not added by default, show a hint suggesting how to add it

Guida contributor