mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add tool.uv.sources
to the "Settings" reference (#8543)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo test | windows (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / cargo test | macos (push) Blocked by required conditions
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo dev generate-all (push) Blocked by required conditions
CI / cargo shear (push) Waiting to run
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / build binary | linux (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo test | windows (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / cargo test | macos (push) Blocked by required conditions
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo dev generate-all (push) Blocked by required conditions
CI / cargo shear (push) Waiting to run
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / build binary | linux (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary Closes https://github.com/astral-sh/uv/issues/8540.
This commit is contained in:
parent
99a87464eb
commit
58b5fd4aff
5 changed files with 81 additions and 6 deletions
|
@ -101,7 +101,14 @@ fn generate() -> String {
|
|||
generate_command(&mut output, &uv, &mut parents);
|
||||
|
||||
for (value, replacement) in REPLACEMENTS {
|
||||
output = output.replace(value, replacement);
|
||||
assert_ne!(
|
||||
value, replacement,
|
||||
"`value` and `replacement` must be different, but both are `{value}`"
|
||||
);
|
||||
let before = &output;
|
||||
let after = output.replace(value, replacement);
|
||||
assert_ne!(*before, after, "Could not find `{value}` in the output");
|
||||
output = after;
|
||||
}
|
||||
|
||||
output
|
||||
|
|
|
@ -33,8 +33,8 @@ pub(crate) struct Args {
|
|||
}
|
||||
|
||||
pub(crate) fn main(args: &Args) -> Result<()> {
|
||||
let schema = schema_for!(CombinedOptions);
|
||||
let schema_string = serde_json::to_string_pretty(&schema).unwrap();
|
||||
// Generate the schema.
|
||||
let schema_string = generate();
|
||||
let filename = "uv.schema.json";
|
||||
let schema_path = PathBuf::from(ROOT_DIR).join(filename);
|
||||
|
||||
|
@ -80,5 +80,32 @@ pub(crate) fn main(args: &Args) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
const REPLACEMENTS: &[(&str, &str)] = &[
|
||||
// Use the fully-resolved URL rather than the relative Markdown path.
|
||||
(
|
||||
"(../concepts/dependencies.md)",
|
||||
"(https://docs.astral.sh/uv/concepts/dependencies/)",
|
||||
),
|
||||
];
|
||||
|
||||
/// Generate the JSON schema for the combined options as a string.
|
||||
fn generate() -> String {
|
||||
let schema = schema_for!(CombinedOptions);
|
||||
let mut output = serde_json::to_string_pretty(&schema).unwrap();
|
||||
|
||||
for (value, replacement) in REPLACEMENTS {
|
||||
assert_ne!(
|
||||
value, replacement,
|
||||
"`value` and `replacement` must be different, but both are `{value}`"
|
||||
);
|
||||
let before = &output;
|
||||
let after = output.replace(value, replacement);
|
||||
assert_ne!(*before, after, "Could not find `{value}` in the output");
|
||||
output = after;
|
||||
}
|
||||
|
||||
output
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -152,8 +152,23 @@ pub struct Tool {
|
|||
#[serde(rename_all = "kebab-case")]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct ToolUv {
|
||||
/// The sources to use (e.g., workspace members, Git repositories, local paths) when resolving
|
||||
/// dependencies.
|
||||
/// The sources to use when resolving dependencies.
|
||||
///
|
||||
/// `tool.uv.sources` enriches the dependency metadata with additional sources, incorporated
|
||||
/// during development. A dependency source can be a Git repository, a URL, a local path, or an
|
||||
/// alternative registry.
|
||||
///
|
||||
/// See [Dependencies](../concepts/dependencies.md) for more.
|
||||
#[option(
|
||||
default = "\"[]\"",
|
||||
value_type = "dict",
|
||||
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" }
|
||||
pydantic = { path = "/path/to/pydantic", editable = true }
|
||||
"#
|
||||
)]
|
||||
pub sources: Option<ToolUvSources>,
|
||||
|
||||
/// The indexes to use when resolving dependencies.
|
||||
|
|
|
@ -198,6 +198,32 @@ package = false
|
|||
|
||||
---
|
||||
|
||||
### [`sources`](#sources) {: #sources }
|
||||
|
||||
The sources to use when resolving dependencies.
|
||||
|
||||
`tool.uv.sources` enriches the dependency metadata with additional sources, incorporated
|
||||
during development. A dependency source can be a Git repository, a URL, a local path, or an
|
||||
alternative registry.
|
||||
|
||||
See [Dependencies](../concepts/dependencies.md) for more.
|
||||
|
||||
**Default value**: `"[]"`
|
||||
|
||||
**Type**: `dict`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
```toml title="pyproject.toml"
|
||||
|
||||
[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" }
|
||||
pydantic = { path = "/path/to/pydantic", editable = true }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `workspace`
|
||||
|
||||
#### [`exclude`](#workspace_exclude) {: #workspace_exclude }
|
||||
|
|
2
uv.schema.json
generated
2
uv.schema.json
generated
|
@ -398,7 +398,7 @@
|
|||
]
|
||||
},
|
||||
"sources": {
|
||||
"description": "The sources to use (e.g., workspace members, Git repositories, local paths) when resolving dependencies.",
|
||||
"description": "The sources to use when resolving dependencies.\n\n`tool.uv.sources` enriches the dependency metadata with additional sources, incorporated during development. A dependency source can be a Git repository, a URL, a local path, or an alternative registry.\n\nSee [Dependencies](https://docs.astral.sh/uv/concepts/dependencies/) for more.",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolUvSources"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue