mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Add uv sync --script
(#11361)
## Summary The environment is located at a stable path within the cache, based on the script's absolute path. If a lockfile exists for the script, then we use our standard lockfile semantics (i.e., update the lockfile if necessary, etc.); if not, we just do a `uv pip sync` (roughly). Example usage: ``` ❯ uv init --script hello.py Initialized script at `hello.py` ❯ uv add --script hello.py requests Updated `hello.py` ❯ cargo run sync --script hello.py Using script environment at: /Users/crmarsh/.cache/uv/environments-v1/hello-84e289fe3f6241a0 Resolved 5 packages in 3ms Installed 5 packages in 12ms + certifi==2025.1.31 + charset-normalizer==3.4.1 + idna==3.10 + requests==2.32.3 + urllib3==2.3.0 ``` Closes https://github.com/astral-sh/uv/issues/6637.
This commit is contained in:
parent
0b4a349173
commit
792dc9d1c5
12 changed files with 961 additions and 274 deletions
|
@ -3135,6 +3135,32 @@ pub struct SyncArgs {
|
|||
#[arg(long, conflicts_with = "all_packages")]
|
||||
pub package: Option<PackageName>,
|
||||
|
||||
/// Sync the environment for a Python script, rather than the current project.
|
||||
///
|
||||
/// If provided, uv will sync the dependencies based on the script's inline metadata table, in
|
||||
/// adherence with PEP 723.
|
||||
#[arg(
|
||||
long,
|
||||
conflicts_with = "active",
|
||||
conflicts_with = "all_packages",
|
||||
conflicts_with = "package",
|
||||
conflicts_with = "no_install_project",
|
||||
conflicts_with = "no_install_workspace",
|
||||
conflicts_with = "extra",
|
||||
conflicts_with = "all_extras",
|
||||
conflicts_with = "no_extra",
|
||||
conflicts_with = "no_all_extras",
|
||||
conflicts_with = "dev",
|
||||
conflicts_with = "no_dev",
|
||||
conflicts_with = "only_dev",
|
||||
conflicts_with = "group",
|
||||
conflicts_with = "no_group",
|
||||
conflicts_with = "no_default_groups",
|
||||
conflicts_with = "only_group",
|
||||
conflicts_with = "all_groups"
|
||||
)]
|
||||
pub script: Option<PathBuf>,
|
||||
|
||||
/// The Python interpreter to use for the project environment.
|
||||
///
|
||||
/// By default, the first interpreter that meets the project's `requires-python` constraint is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue