astral-sh/uv

Consider adding workspace members as sources in `uv init`

Open

#5 388 ouverte le 24 juil. 2024

Voir sur GitHub
 (5 commentaires) (0 réactions) (0 assignés)Rust (3 111 forks)batch import
cligood first issueprojects

Métriques du dépôt

Stars
 (84 934 stars)
Métriques de merge PR
 (Merge moyen 7j 16h) (259 PRs mergées en 30 j)

Description

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

Guide contributeur