mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Rename --raw-sources
to --raw
(#13348)
Some checks are pending
CI / Determine changes (push) Waiting to run
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 / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (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 / build binary | linux libc (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / smoke test | macos (push) Blocked by required conditions
CI / smoke test | windows x86_64 (push) Blocked by required conditions
CI / smoke test | windows aarch64 (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | deadsnakes python3.9 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 | 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 | free-threaded python on 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 / integration test | uv_build (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 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 / mkdocs (push) Waiting to run
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / build binary | linux musl (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 x86_64 (push) Blocked by required conditions
CI / build binary | windows aarch64 (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | pydantic/pydantic-core (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / smoke test | linux (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 | graalpy on ubuntu (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 | 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 x86-64 (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 x86-64 (push) Blocked by required conditions
CI / check system | x86-64 python3.13 on windows aarch64 (push) Blocked by required conditions
CI / check system | windows registry (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 macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.8 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.11 on linux x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on linux x86-64 (push) Blocked by required conditions
CI / check system | conda3.11 on windows x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on windows x86-64 (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows x86-64 (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Some checks are pending
CI / Determine changes (push) Waiting to run
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 / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (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 / build binary | linux libc (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / smoke test | macos (push) Blocked by required conditions
CI / smoke test | windows x86_64 (push) Blocked by required conditions
CI / smoke test | windows aarch64 (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | deadsnakes python3.9 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 | 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 | free-threaded python on 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 / integration test | uv_build (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 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 / mkdocs (push) Waiting to run
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / build binary | linux musl (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 x86_64 (push) Blocked by required conditions
CI / build binary | windows aarch64 (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | pydantic/pydantic-core (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / smoke test | linux (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 | graalpy on ubuntu (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 | 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 x86-64 (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 x86-64 (push) Blocked by required conditions
CI / check system | x86-64 python3.13 on windows aarch64 (push) Blocked by required conditions
CI / check system | windows registry (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 macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.8 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.11 on linux x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on linux x86-64 (push) Blocked by required conditions
CI / check system | conda3.11 on windows x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on windows x86-64 (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows x86-64 (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
This also omits bounds on constraints, and is useful for that. This retains `--raw-sources` as an alias. I've had this on my mind for a while, but https://github.com/astral-sh/uv/pull/12946 reminded me of it again.
This commit is contained in:
parent
9a15240147
commit
26e37f3a1e
6 changed files with 31 additions and 24 deletions
|
@ -3481,19 +3481,24 @@ pub struct AddArgs {
|
|||
#[arg(long, overrides_with = "editable", hide = true)]
|
||||
pub no_editable: bool,
|
||||
|
||||
/// Add source requirements to `project.dependencies`, rather than `tool.uv.sources`.
|
||||
/// Add a dependency as provided.
|
||||
///
|
||||
/// By default, uv will use the `tool.uv.sources` section to record source information for Git,
|
||||
/// local, editable, and direct URL requirements.
|
||||
/// local, editable, and direct URL requirements. When `--raw` is provided, uv will add source
|
||||
/// requirements to `project.dependencies`, rather than `tool.uv.sources`.
|
||||
///
|
||||
/// Additionally, by default, uv will add bounds to your dependency, e.g., `foo>=1.0.0`. When
|
||||
/// `--raw` is provided, uv will add the dependency without bounds.
|
||||
#[arg(
|
||||
long,
|
||||
conflicts_with = "editable",
|
||||
conflicts_with = "no_editable",
|
||||
conflicts_with = "rev",
|
||||
conflicts_with = "tag",
|
||||
conflicts_with = "branch"
|
||||
conflicts_with = "branch",
|
||||
alias = "raw-sources"
|
||||
)]
|
||||
pub raw_sources: bool,
|
||||
pub raw: bool,
|
||||
|
||||
/// Commit to use when adding a dependency from Git.
|
||||
#[arg(long, group = "git-ref", action = clap::ArgAction::Set)]
|
||||
|
|
|
@ -72,7 +72,7 @@ pub(crate) async fn add(
|
|||
marker: Option<MarkerTree>,
|
||||
editable: Option<bool>,
|
||||
dependency_type: DependencyType,
|
||||
raw_sources: bool,
|
||||
raw: bool,
|
||||
indexes: Vec<Index>,
|
||||
rev: Option<String>,
|
||||
tag: Option<String>,
|
||||
|
@ -444,7 +444,7 @@ pub(crate) async fn add(
|
|||
&target,
|
||||
editable,
|
||||
&dependency_type,
|
||||
raw_sources,
|
||||
raw,
|
||||
rev.as_deref(),
|
||||
tag.as_deref(),
|
||||
branch.as_deref(),
|
||||
|
@ -454,7 +454,7 @@ pub(crate) async fn add(
|
|||
)?;
|
||||
|
||||
// Add any indexes that were provided on the command-line, in priority order.
|
||||
if !raw_sources {
|
||||
if !raw {
|
||||
let urls = IndexUrls::from_indexes(indexes);
|
||||
for index in urls.defined_indexes() {
|
||||
toml.add_index(index)?;
|
||||
|
@ -519,7 +519,7 @@ pub(crate) async fn add(
|
|||
sync_state,
|
||||
locked,
|
||||
&dependency_type,
|
||||
raw_sources,
|
||||
raw,
|
||||
constraints,
|
||||
&settings,
|
||||
&network_settings,
|
||||
|
@ -551,7 +551,7 @@ fn edits(
|
|||
target: &AddTarget,
|
||||
editable: Option<bool>,
|
||||
dependency_type: &DependencyType,
|
||||
raw_sources: bool,
|
||||
raw: bool,
|
||||
rev: Option<&str>,
|
||||
tag: Option<&str>,
|
||||
branch: Option<&str>,
|
||||
|
@ -569,7 +569,7 @@ fn edits(
|
|||
requirement.extras = ex.into_boxed_slice();
|
||||
|
||||
let (requirement, source) = match target {
|
||||
AddTarget::Script(_, _) | AddTarget::Project(_, _) if raw_sources => {
|
||||
AddTarget::Script(_, _) | AddTarget::Project(_, _) if raw => {
|
||||
(uv_pep508::Requirement::from(requirement), None)
|
||||
}
|
||||
AddTarget::Script(ref script, _) => {
|
||||
|
@ -743,7 +743,7 @@ async fn lock_and_sync(
|
|||
sync_state: PlatformState,
|
||||
locked: bool,
|
||||
dependency_type: &DependencyType,
|
||||
raw_sources: bool,
|
||||
raw: bool,
|
||||
constraints: Vec<NameRequirementSpecification>,
|
||||
settings: &ResolverInstallerSettings,
|
||||
network_settings: &NetworkSettings,
|
||||
|
@ -774,7 +774,7 @@ async fn lock_and_sync(
|
|||
.into_lock();
|
||||
|
||||
// Avoid modifying the user request further if `--raw-sources` is set.
|
||||
if !raw_sources {
|
||||
if !raw {
|
||||
// Extract the minimum-supported version for each dependency.
|
||||
let mut minimum_version =
|
||||
FxHashMap::with_capacity_and_hasher(lock.packages().len(), FxBuildHasher);
|
||||
|
|
|
@ -1869,7 +1869,7 @@ async fn run_project(
|
|||
args.marker,
|
||||
args.editable,
|
||||
args.dependency_type,
|
||||
args.raw_sources,
|
||||
args.raw,
|
||||
args.indexes,
|
||||
args.rev,
|
||||
args.tag,
|
||||
|
|
|
@ -1252,7 +1252,7 @@ pub(crate) struct AddSettings {
|
|||
pub(crate) dependency_type: DependencyType,
|
||||
pub(crate) editable: Option<bool>,
|
||||
pub(crate) extras: Vec<ExtraName>,
|
||||
pub(crate) raw_sources: bool,
|
||||
pub(crate) raw: bool,
|
||||
pub(crate) rev: Option<String>,
|
||||
pub(crate) tag: Option<String>,
|
||||
pub(crate) branch: Option<String>,
|
||||
|
@ -1280,7 +1280,7 @@ impl AddSettings {
|
|||
editable,
|
||||
no_editable,
|
||||
extra,
|
||||
raw_sources,
|
||||
raw,
|
||||
rev,
|
||||
tag,
|
||||
branch,
|
||||
|
@ -1371,7 +1371,7 @@ impl AddSettings {
|
|||
.collect(),
|
||||
marker,
|
||||
dependency_type,
|
||||
raw_sources,
|
||||
raw,
|
||||
rev,
|
||||
tag,
|
||||
branch,
|
||||
|
|
|
@ -799,18 +799,18 @@ fn add_raw_error() -> Result<()> {
|
|||
"#})?;
|
||||
|
||||
// Provide a tag without a Git source.
|
||||
uv_snapshot!(context.filters(), context.add().arg("uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage").arg("--tag").arg("0.0.1").arg("--raw-sources"), @r###"
|
||||
uv_snapshot!(context.filters(), context.add().arg("uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage").arg("--tag").arg("0.0.1").arg("--raw-sources"), @r"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: the argument '--tag <TAG>' cannot be used with '--raw-sources'
|
||||
error: the argument '--tag <TAG>' cannot be used with '--raw'
|
||||
|
||||
Usage: uv add --cache-dir [CACHE_DIR] --tag <TAG> --exclude-newer <EXCLUDE_NEWER> <PACKAGES|--requirements <REQUIREMENTS>>
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -3959,7 +3959,7 @@ fn add_lower_bound_existing() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Avoid setting a lower bound with `--raw-sources`.
|
||||
/// Avoid setting a lower bound with `--raw`.
|
||||
#[test]
|
||||
fn add_lower_bound_raw() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
|
@ -3973,8 +3973,8 @@ fn add_lower_bound_raw() -> Result<()> {
|
|||
dependencies = ["anyio"]
|
||||
"#})?;
|
||||
|
||||
// Adding `anyio` should _not_ set a lower-bound when using `--raw-sources`.
|
||||
uv_snapshot!(context.filters(), context.add().arg("anyio").arg("--raw-sources"), @r"
|
||||
// Adding `anyio` should _not_ set a lower-bound when using `--raw`.
|
||||
uv_snapshot!(context.filters(), context.add().arg("anyio").arg("--raw"), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -1068,9 +1068,11 @@ uv add [OPTIONS] <PACKAGES|--requirements <REQUIREMENTS>>
|
|||
|
||||
<p>Repeating this option, e.g., <code>-qq</code>, will enable a silent mode in which uv will write no output to stdout.</p>
|
||||
|
||||
</dd><dt id="uv-add--raw-sources"><a href="#uv-add--raw-sources"><code>--raw-sources</code></a></dt><dd><p>Add source requirements to <code>project.dependencies</code>, rather than <code>tool.uv.sources</code>.</p>
|
||||
</dd><dt id="uv-add--raw"><a href="#uv-add--raw"><code>--raw</code></a>, <code>--raw-sources</code></dt><dd><p>Add a dependency as provided.</p>
|
||||
|
||||
<p>By default, uv will use the <code>tool.uv.sources</code> section to record source information for Git, local, editable, and direct URL requirements.</p>
|
||||
<p>By default, uv will use the <code>tool.uv.sources</code> section to record source information for Git, local, editable, and direct URL requirements. When <code>--raw</code> is provided, uv will add source requirements to <code>project.dependencies</code>, rather than <code>tool.uv.sources</code>.</p>
|
||||
|
||||
<p>Additionally, by default, uv will add bounds to your dependency, e.g., <code>foo>=1.0.0</code>. When <code>--raw</code> is provided, uv will add the dependency without bounds.</p>
|
||||
|
||||
</dd><dt id="uv-add--refresh"><a href="#uv-add--refresh"><code>--refresh</code></a></dt><dd><p>Refresh all cached data</p>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue