astral-sh/uv

Consider adding workspace members as sources in `uv init`

Open

#5,388 建立於 2024年7月24日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Rust (3,111 fork)batch import
cligood first issueprojects

倉庫指標

Star
 (84,934 star)
PR 合併指標
 (平均合併 7天 16小時) (30 天內合併 259 個 PR)

描述

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

貢獻者指南