From b24fb774b1c7ff70b2e7ffe9cf5db0c2e4f60323 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Mon, 23 Dec 2024 22:12:45 +0100 Subject: [PATCH] docs: fix invalid syntax in some sources examples (#10127) ## Summary TOML 1.0 doesn't support multi-line for inline tables, so those examples are invalid. --- crates/uv-workspace/src/pyproject.rs | 2 +- docs/concepts/projects/dependencies.md | 33 +++++--------------------- docs/reference/settings.md | 2 +- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/crates/uv-workspace/src/pyproject.rs b/crates/uv-workspace/src/pyproject.rs index e93c9d63b843..a6ee2b2536a7 100644 --- a/crates/uv-workspace/src/pyproject.rs +++ b/crates/uv-workspace/src/pyproject.rs @@ -292,7 +292,7 @@ pub struct ToolUv { example = r#" [tool.uv.sources] httpx = { git = "https://github.com/encode/httpx", tag = "0.27.0" } - pytest = { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl" } + pytest = { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl" } pydantic = { path = "/path/to/pydantic", editable = true } "# )] diff --git a/docs/concepts/projects/dependencies.md b/docs/concepts/projects/dependencies.md index 80e995449ee4..4e5a5f084046 100644 --- a/docs/concepts/projects/dependencies.md +++ b/docs/concepts/projects/dependencies.md @@ -290,10 +290,7 @@ $ uv add git+https://github.com/encode/httpx --tag 0.27.0 dependencies = ["httpx"] [tool.uv.sources] -httpx = { - git = "https://github.com/encode/httpx", - tag = "0.27.0" -} +httpx = { git = "https://github.com/encode/httpx", tag = "0.27.0" } ``` Or, a branch: @@ -307,10 +304,7 @@ $ uv add git+https://github.com/encode/httpx --branch main dependencies = ["httpx"] [tool.uv.sources] -httpx = { - git = "https://github.com/encode/httpx", - branch = "main" -} +httpx = { git = "https://github.com/encode/httpx", branch = "main" } ``` Or, a revision (commit): @@ -324,10 +318,7 @@ $ uv add git+https://github.com/encode/httpx --rev 326b9431c761e1ef1e00b9f760d1f dependencies = ["httpx"] [tool.uv.sources] -httpx = { - git = "https://github.com/encode/httpx", - rev = "326b9431c761e1ef1e00b9f760d1f654c8db48c6" -} +httpx = { git = "https://github.com/encode/httpx", rev = "326b9431c761e1ef1e00b9f760d1f654c8db48c6" } ``` A `subdirectory` may be specified if the package isn't in the repository root. @@ -438,11 +429,7 @@ For example, to pull `httpx` from GitHub, but only on macOS, use the following: dependencies = ["httpx"] [tool.uv.sources] -httpx = { - git = "https://github.com/encode/httpx", - tag = "0.27.2", - marker = "sys_platform == 'darwin'" -} +httpx = { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" } ``` By specifying the marker on the source, uv will still include `httpx` on all platforms, but will @@ -462,16 +449,8 @@ dependencies = ["httpx"] [tool.uv.sources] httpx = [ - { - git = "https://github.com/encode/httpx", - tag = "0.27.2", - marker = "sys_platform == 'darwin'" - }, - { - git = "https://github.com/encode/httpx", - tag = "0.24.1", - marker = "sys_platform == 'linux'" - }, + { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" }, + { git = "https://github.com/encode/httpx", tag = "0.24.1", marker = "sys_platform == 'linux'" }, ] ``` diff --git a/docs/reference/settings.md b/docs/reference/settings.md index 317d8fb75557..01e4d2a7c53d 100644 --- a/docs/reference/settings.md +++ b/docs/reference/settings.md @@ -293,7 +293,7 @@ See [Dependencies](../concepts/projects/dependencies.md) for more. [tool.uv.sources] httpx = { git = "https://github.com/encode/httpx", tag = "0.27.0" } -pytest = { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl" } +pytest = { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl" } pydantic = { path = "/path/to/pydantic", editable = true } ```