-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add pip-compatible --group
flag to uv pip install
and uv pip compile
#11686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// Deduplicate in a stable way to get deterministic behaviour | ||
let deduped_paths = groups | ||
.iter() | ||
.map(|group| &group.path) | ||
.collect::<BTreeSet<_>>(); | ||
group_requirements = deduped_paths | ||
.into_iter() | ||
.map(|path| RequirementsSource::PyprojectToml(path.to_owned())) | ||
.collect::<Vec<_>>(); | ||
requirements = &group_requirements[..]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started doing a cleanup pass to compute a BTreeMap<PathBuf, Vec<GroupName>>
that would be used by subsequent steps but it was just more code and value threading for no real benefit over the current impl that just does a filter(group.path == path)
later.
FYI, pip support was merged. |
crates/uv-cli/src/lib.rs
Outdated
/// Ignore the package and it's dependencies, only install from the specified dependency group. | ||
/// | ||
/// May be provided multiple times. | ||
#[arg(long, group = "sources", conflicts_with_all = ["requirements", "package", "editable"])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these conflicts present in the pip
implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(it doesn't really look like it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought -r
was exclusive to our CLI (I didn't check the others though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah -r
is exclusive to us, but I'd expect pip install -e . --group foo
and pip install anyio --group foo
to work unless they explicitly choose for it not to upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Whether -r
should have the same semantics as these other options, I'm not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One problem is that uv pip install -r pyproject.toml --extra foo
is the "correct" use of --extra
but uv pip install -r pyproject.toml --group foo
would be invalid? Even more confusing, if we allow it, uv pip install -r foo/pyproject.toml --group bar
would install bar
from ./pyproject.toml
instead of foo/pyproject.toml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's part of why I opted to disallow it. The upstream pip semantics are really confusing to pair with anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important that we're compatible with pip on whether --group
can be used with <package>
and --editable
though, which introduces all the same complexities.
I implemented/pushed the following changes, because I needed to wrap my head around them in code/tests to think them through semantically:
|
Zanie convinced me that pip-compile is fine actually, so I just loosened the CLI restriction to make it accepted. I'm just adding more tests now. |
6e578d9
to
9376d4f
Compare
--group
flag to uv pip install
--group
flag to uv pip install
and uv pip compile
Can you share the current state of this? It looks like you updated the PR summary to cover the behavior we discussed? |
9376d4f
to
4d3b843
Compare
I believe the PR is in the final state I'd like. Possibly it could have Even More tests but I'm not sure it would add much. (Just rebased) |
1cc738b
to
0dfe672
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. I have mostly minor comments, though the --project
bit might be blocking?
We should add this to the documentation at
We may want to mark --group
on uv pip compile
as "in preview" until support lands in pip-tools
. See jazzband/pip-tools#2062. It looks like they're just considering using ::
instead of :
as a separator? Moving this to preview would involve a runtime warning and a note in the doc.
requirement_sources.push(source); | ||
} | ||
|
||
// pip `--group` flags specify their own sources, which we need to process here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this makes sense, but it might be relevant for Charlie to take a look at before merging.
Ooookay I think that's all review feedback addressed! |
crates/uv/tests/it/pip_install.rs
Outdated
----- stdout ----- | ||
|
||
----- stderr ----- | ||
error: The dependency group 'bar' was not found in pyproject.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want "in the pyproject.toml
"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a path we're displaying, maybe "was not found: {path}"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could say "The dependency group 'bar' was not found in the project at {}
"
It's a little weird for the working directory, maybe we'd want a ./
there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we wanna do that I'd make it a change to path.user_display() across the board (I think it's fine as is...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes sense to do it across the board. "in the project at pyproject.toml" reads pretty weird. A little better if it's in backticks though. We can always special case that though, "in the project in the working directory" or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready. It's hard to keep track of everything with the scope of the changes.
I have a few stylistic nits remaining and want to see more user-facing documentation explaining how --group
interacts with other options and how it differs from the rest of the uv interface. We can push that into a separate pull request, but it's very important. I'm happy to help with that if you need it.
c008a5f
to
6b0abb5
Compare
Rebased and addressed review in latest commit. |
@@ -135,7 +135,7 @@ impl<'a, Context: BuildContext> SourceTreeResolver<'a, Context> { | |||
for name in groups.explicit_names() { | |||
if !metadata.dependency_groups.contains_key(name) { | |||
return Err(anyhow::anyhow!( | |||
"The dependency group '{name}' was not found in {}", | |||
"The dependency group '{name}' was not found in the project at {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks on the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I assumed we purposefully avoided that in our style so the path was easy to copy/alt-click in terminals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is why I suggested the : {path}
approach)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We either do : {path}
or use backticks.
docs/pip/compile.md
Outdated
This is an attempt to make `uv pip compile` and `uv pip install` behave similarly. | ||
A `--group` flag has to be added to pip-tools' `pip compile`, [although they're considering it](https://github.com/jazzband/pip-tools/issues/2062). We expect to support whatever syntax and semantics they adopt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not say "This is an attempt" in public facing copy. I'd just omit that whole sentence.
I think the second bit is a separate note? I'd use !!! note
for the first part. Then add a separate !!! important
that says
A
--group
flag has not yet been implemented inpip-tools
and we may change our semantics to match the upstream behavior when it is finalized. The upstream behavior can be tracked in ...
I'd move this to the first use of pip compile --group
above a bit so there's not two admonitions in a row.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, yeah I wanted two separate notes but got stuck on the back-to-backness. adding distance between them is a fine compromise.
docs/pip/packages.md
Outdated
`--group` flags do not apply to other sources specified with flags like `-r` or -e`. | ||
For instance, `uv pip install -r some/path/pyproject.toml --group foo` sources `foo` | ||
from `./pyproject.toml` and **not** `some/path/pyproject.toml`. | ||
This matches the behaviour that `pip install` is shipping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say "This matches the behaviour that pip install
is shipping." — it'll be stale once they ship it and is a bit superfluous here as the assumption is we match pip's behavior.
docs/pip/packages.md
Outdated
|
||
!!! note | ||
|
||
`--group` flags do not apply to other sources specified with flags like `-r` or -e`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could say, "As in pip, " if you want to mention that it is done to match pip's behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh I like that. I felt the need to specify that because I don't think we would have picked that behaviour in a vacuum and I expect some people will want to suggest changing it. Maybe too defensive 😅
Done for reals? |
Yeah let's go :D |
This PR switches from using optional-dependencies to dependency-groups for several development dependencies This depends on: - tox-dev/tox#3409 - astral-sh/uv#8272 - astral-sh/uv#8590 - astral-sh/uv#8969 - astral-sh/uv#10861 - astral-sh/uv#11686 (actually incorporated in uv 0.6.8) - readthedocs/readthedocs.org#11766, will be solved by readthedocs/readthedocs.org#11710
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.6.5` -> `0.6.9` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.6.9`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#069) [Compare Source](astral-sh/uv@0.6.8...0.6.9) ##### Enhancements - Use `keyring --mode creds` when `authenticate = "always"` ([#​12316](astral-sh/uv#12316)) - Fail with specific error message when no password is present and `authenticate = "always"` ([#​12313](astral-sh/uv#12313)) ##### Bug fixes - Add boolish value parser for `UV_MANAGED_PYTHON` flags ([#​12345](astral-sh/uv#12345)) - Make deserialization non-fatal when assessing source tree revisions ([#​12319](astral-sh/uv#12319)) - Use resolver-returned wheel over alternate cached wheel ([#​12301](astral-sh/uv#12301)) ##### Documentation - Add experimental `--torch-backend` to the PyTorch guide ([#​12317](astral-sh/uv#12317)) - Fix `#keyring-provider` references in alternative index docs ([#​12315](astral-sh/uv#12315)) - Fix `--directory` path in examples ([#​12165](astral-sh/uv#12165)) ##### Preview changes - Automatically infer the PyTorch index via `--torch-backend=auto` ([#​12070](astral-sh/uv#12070)) ### [`v0.6.8`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#068) [Compare Source](astral-sh/uv@0.6.7...0.6.8) ##### Enhancements - Add support for enabling all groups by default with `default-groups = "all"` ([#​12289](astral-sh/uv#12289)) - Add simpler `--managed-python` and `--no-managed-python` flags for toggling Python preferences ([#​12246](astral-sh/uv#12246)) ##### Performance - Avoid allocations for default cache keys ([#​12063](astral-sh/uv#12063)) ##### Bug fixes - Allow local version mismatches when validating lockfile ([#​12285](astral-sh/uv#12285)) - Allow owned string when deserializing `requires-python` ([#​12278](astral-sh/uv#12278)) - Make cache errors non-fatal in `Planner::build` ([#​12281](astral-sh/uv#12281)) ### [`v0.6.7`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#067) [Compare Source](astral-sh/uv@0.6.6...0.6.7) ##### Python - Add CPython 3.14.0a6 - Fix regression where extension modules would use wrong `CXX` compiler on Linux - Enable FTS3 enhanced query syntax for SQLite See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250317) for more details. ##### Enhancements - Add support for `-c` constraints in `uv add` ([#​12209](astral-sh/uv#12209)) - Add support for `--global` default version in `uv python pin` ([#​12115](astral-sh/uv#12115)) - Always reinstall local source trees passed to `uv pip install` ([#​12176](astral-sh/uv#12176)) - Render token claims on publish permission error ([#​12135](astral-sh/uv#12135)) - Add pip-compatible `--group` flag to `uv pip install` and `uv pip compile` ([#​11686](astral-sh/uv#11686)) ##### Preview features - Avoid creating duplicate directory entries in built wheels ([#​12206](astral-sh/uv#12206)) - Allow overriding module names for editable builds ([#​12137](astral-sh/uv#12137)) ##### Performance - Avoid replicating core-metadata field on `File` struct ([#​12159](astral-sh/uv#12159)) ##### Bug fixes - Add `src` to default cache keys ([#​12062](astral-sh/uv#12062)) - Discard insufficient fork markers ([#​10682](astral-sh/uv#10682)) - Ensure `python pin --global` creates parent directories if missing ([#​12180](astral-sh/uv#12180)) - Fix GraalPy abi tag parsing and discovery ([#​12154](astral-sh/uv#12154)) - Remove extraneous script packages in `uv sync --script` ([#​12158](astral-sh/uv#12158)) - Remove redundant `activate.bat` output ([#​12160](astral-sh/uv#12160)) - Avoid subsequent index hint when no versions are available on the first index ([#​9332](astral-sh/uv#9332)) - Error on lockfiles with incoherent wheel versions ([#​12235](astral-sh/uv#12235)) ##### Rust API - Update `BaseClientBuild` to accept custom proxies ([#​12232](astral-sh/uv#12232)) ##### Documentation - Make testpypi index explicit in example snippet ([#​12148](astral-sh/uv#12148)) - Reverse and format the archived changelogs ([#​12099](astral-sh/uv#12099)) - Use consistent commas around i.e. and e.g. ([#​12157](astral-sh/uv#12157)) - Fix typos in MRE docs ([#​12198](astral-sh/uv#12198)) - Fix double space typo ([#​12171](astral-sh/uv#12171)) ### [`v0.6.6`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#066) [Compare Source](astral-sh/uv@0.6.5...0.6.6) ##### Python - Add support for dynamic musl Python distributions on x86-64 Linux ([#​12121](astral-sh/uv#12121)) - Allow the experimental JIT to be enabled at runtime on Python 3.13 and 3.14 on Linux - Upgrade the build toolchain to LLVM 20, improving performance See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250311) for more details. ##### Enhancements - Add `--marker` flag to `uv add` ([#​12012](astral-sh/uv#12012)) - Allow overriding module name for uv build backend ([#​11884](astral-sh/uv#11884)) - Sync latest Python releases ([#​12120](astral-sh/uv#12120)) - Use 'Upload' instead of 'Download' in publish reporter ([#​12029](astral-sh/uv#12029)) - Add `[index].authenticate` allowing authentication to be required on an index ([#​11896](astral-sh/uv#11896)) - Add support for Windows legacy scripts in `uv tool run` ([#​12079](astral-sh/uv#12079)) - Propagate conflicting dependency groups when using `include-group` ([#​12005](astral-sh/uv#12005)) - Show ambiguous requirements when `uv add` failed ([#​12106](astral-sh/uv#12106)) ##### Performance - Cache workspace discovery ([#​12096](astral-sh/uv#12096)) - Insert dependencies into fork state prior to fetching metadata ([#​12057](astral-sh/uv#12057)) - Remove some allocations from `uv-auth` ([#​12077](astral-sh/uv#12077)) ##### Bug fixes - Avoid considering `PATH` updated when the `export` is commented in the shellrc ([#​12043](astral-sh/uv#12043)) - Fix `uv publish` retry on network failures ([#​12041](astral-sh/uv#12041)) - Use a sized stream in `uv publish` to comply with WSGI PyPI server constraints ([#​12111](astral-sh/uv#12111)) - Fix `uv python install --reinstall` when the version was not previously installed ([#​12124](astral-sh/uv#12124)) ##### Preview features - Fix `uv_build` invocation ([#​12058](astral-sh/uv#12058)) ##### Documentation - Quote versions string in `python-versions.md` ([#​12112](astral-sh/uv#12112)) - Fix tool concept page headings ([#​12053](astral-sh/uv#12053)) - Update the `[index].authenticate` docs ([#​12102](astral-sh/uv#12102)) - Update versioning policy ([#​11666](astral-sh/uv#11666)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTQuMCIsInVwZGF0ZWRJblZlciI6IjM5LjIwOS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
## 0.6.14 ### Python versions The following Python versions have been added: - CPython 3.13.3 - CPython 3.12.10 - CPython 3.11.12 - CPython 3.10.17 - CPython 3.9.22 See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250409) for more details. ### Enhancements - Add `uv-build` and `uv_build` aliases to `uv init --build-backend` ([#12776](astral-sh/uv#12776)) - Emit dedicated error message for Conda `environment.yml` files ([#12669](astral-sh/uv#12669)) ### Preview features - Build backend: Check module dir exists for sdist build ([#12779](astral-sh/uv#12779)) - Build backend: Fix sdist with long directories ([#12764](astral-sh/uv#12764)) ### Performance - Avoid querying GitHub on repeated install invocations ([#12767](astral-sh/uv#12767)) ### Bug fixes - Error when `tool.uv.sources` is set in system-level configuration file ([#12757](astral-sh/uv#12757)) - Split workspace members onto their own lines in `uv init` ([#12756](astral-sh/uv#12756)) ### Documentation - Add lockfile note about PEP 751 ([#12732](astral-sh/uv#12732)) - Extend the reference documentation for `uv pip sync` ([#12683](astral-sh/uv#12683)) - Fix mismatched pip interface header / nav titles ([#12640](astral-sh/uv#12640)) ## 0.6.13 ### Enhancements - Add `--show-version` to `uv python find` ([#12376](astral-sh/uv#12376)) - Remove `--no-config` warning from `uv pip compile` and `uv pip sync` ([#12642](astral-sh/uv#12642)) - Skip repeated directories in `PATH` when searching for Python interpreters ([#12367](astral-sh/uv#12367)) - Unset `SCRIPT_PATH` in relocatable activation script ([#12672](astral-sh/uv#12672)) - Add `UV_PYTHON_DOWNLOADS_JSON_URL` to set custom managed python sources ([#10939](astral-sh/uv#10939)) - Reject `pyproject.toml` files in `uv pip compile -o` ([#12673](astral-sh/uv#12673)) - Respect the `--offline` flag for Git operations ([#12619](astral-sh/uv#12619)) ### Bug fixes - Warn instead of error if CRC appears to be missing ([#12722](astral-sh/uv#12722)) - Avoid infinite loop in `uv export` with conflicts ([#12726](astral-sh/uv#12726)) ### Rust API - Update MSRV to 1.84 ([#12670](astral-sh/uv#12670)) ## 0.6.12 ### Enhancements - Report the queried executable path in `uv python list` ([#12628](astral-sh/uv#12628)) - Improve archive unpack error messages ([#12627](astral-sh/uv#12627)) ### Bug fixes - Respect `authenticate` when using `explicit = true` ([#12631](astral-sh/uv#12631)) - Normalize extra and group names in `uv add` and `uv remove` ([#12586](astral-sh/uv#12586)) - Enforce CRC-32 checks when unpacking archives ([#12623](astral-sh/uv#12623)) - Fix parsing of `python-platform` in settings files ([#12592](astral-sh/uv#12592)) ### Documentation - Add note about `uv build` to `package = false` ([#12608](astral-sh/uv#12608)) - Add index fallback note to `authenticate = always` documentation ([#12498](astral-sh/uv#12498)) - Fix invalid 'kind' reference in flat index docs ([#12583](astral-sh/uv#12583)) ## 0.6.11 ### Enhancements - Add dependents ("via ..." comments) in `uv export` command ([#12350](astral-sh/uv#12350)) - Bump least-recent non-EOL macOS version to 13.0 ([#12518](astral-sh/uv#12518)) - Support `--find-links`-style "flat" indexes in `[[tool.uv.index]]` ([#12407](astral-sh/uv#12407)) - Distinguish between `-q` and `-qq` ([#12300](astral-sh/uv#12300)) ### Configuration - Support `UV_PROJECT` environment to set project directory. ([#12327](astral-sh/uv#12327)) ### Performance - Use a boxed slice for various requirement types ([#12514](astral-sh/uv#12514)) ### Bug fixes - Add a newline after metadata when initializing scripts with other metadata blocks ([#12501](astral-sh/uv#12501)) - Avoid writing empty `requires-python` to script blocks ([#12517](astral-sh/uv#12517)) - Respect build constraints in `uv sync` ([#12502](astral-sh/uv#12502)) - Respect transitive dependencies in `uv tree --only-group` ([#12560](astral-sh/uv#12560)) ## 0.6.10 ### Enhancements - Add `uv sync --check` flag ([#12342](astral-sh/uv#12342)) - Add support for Python version requests in `uv python list` ([#12375](astral-sh/uv#12375)) - Support `.env` files in `uv tool run` ([#12386](astral-sh/uv#12386)) - Support `python find --script` ([#11891](astral-sh/uv#11891)) ### Preview features - Check all compatible torch indexes when `--torch-backend` is enabled ([#12385](astral-sh/uv#12385)) ### Performance - Use a boxed slice for extras and groups ([#12391](astral-sh/uv#12391)) - Use small string for index name type ([#12355](astral-sh/uv#12355)) ### Bug fixes - Allow virtual packages with `--no-build` ([#12314](astral-sh/uv#12314)) - Ignore `--find-links` entries for pinned indexes ([#12396](astral-sh/uv#12396)) - Omit wheels from lockfile based on `--exclude-newer` ([#12299](astral-sh/uv#12299)) - Retain end-of-line comment position when adding dependency ([#12360](astral-sh/uv#12360)) - Omit fragment when querying for wheels in Simple HTML API ([#12384](astral-sh/uv#12384)) - Error on missing argument in `requirements.txt` ([#12354](astral-sh/uv#12354)) - Support modules with different casing in build backend ([#12240](astral-sh/uv#12240)) - Add authentication policy support for `pip` commands ([#12470](astral-sh/uv#12470)) ## 0.6.9 ### Enhancements - Use `keyring --mode creds` when `authenticate = "always"` ([#12316](astral-sh/uv#12316)) - Fail with specific error message when no password is present and `authenticate = "always"` ([#12313](astral-sh/uv#12313)) ### Bug fixes - Add boolish value parser for `UV_MANAGED_PYTHON` flags ([#12345](astral-sh/uv#12345)) - Make deserialization non-fatal when assessing source tree revisions ([#12319](astral-sh/uv#12319)) - Use resolver-returned wheel over alternate cached wheel ([#12301](astral-sh/uv#12301)) ### Documentation - Add experimental `--torch-backend` to the PyTorch guide ([#12317](astral-sh/uv#12317)) - Fix `#keyring-provider` references in alternative index docs ([#12315](astral-sh/uv#12315)) - Fix `--directory` path in examples ([#12165](astral-sh/uv#12165)) ### Preview changes - Automatically infer the PyTorch index via `--torch-backend=auto` ([#12070](astral-sh/uv#12070)) ## 0.6.8 ### Enhancements - Add support for enabling all groups by default with `default-groups = "all"` ([#12289](astral-sh/uv#12289)) - Add simpler `--managed-python` and `--no-managed-python` flags for toggling Python preferences ([#12246](astral-sh/uv#12246)) ### Performance - Avoid allocations for default cache keys ([#12063](astral-sh/uv#12063)) ### Bug fixes - Allow local version mismatches when validating lockfile ([#12285](astral-sh/uv#12285)) - Allow owned string when deserializing `requires-python` ([#12278](astral-sh/uv#12278)) - Make cache errors non-fatal in `Planner::build` ([#12281](astral-sh/uv#12281)) ## 0.6.7 ### Python - Add CPython 3.14.0a6 - Fix regression where extension modules would use wrong `CXX` compiler on Linux - Enable FTS3 enhanced query syntax for SQLite See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250317) for more details. ### Enhancements - Add support for `-c` constraints in `uv add` ([#12209](astral-sh/uv#12209)) - Add support for `--global` default version in `uv python pin` ([#12115](astral-sh/uv#12115)) - Always reinstall local source trees passed to `uv pip install` ([#12176](astral-sh/uv#12176)) - Render token claims on publish permission error ([#12135](astral-sh/uv#12135)) - Add pip-compatible `--group` flag to `uv pip install` and `uv pip compile` ([#11686](astral-sh/uv#11686)) ### Preview features - Avoid creating duplicate directory entries in built wheels ([#12206](astral-sh/uv#12206)) - Allow overriding module names for editable builds ([#12137](astral-sh/uv#12137)) ### Performance - Avoid replicating core-metadata field on `File` struct ([#12159](astral-sh/uv#12159)) ### Bug fixes - Add `src` to default cache keys ([#12062](astral-sh/uv#12062)) - Discard insufficient fork markers ([#10682](astral-sh/uv#10682)) - Ensure `python pin --global` creates parent directories if missing ([#12180](astral-sh/uv#12180)) - Fix GraalPy abi tag parsing and discovery ([#12154](astral-sh/uv#12154)) - Remove extraneous script packages in `uv sync --script` ([#12158](astral-sh/uv#12158)) - Remove redundant `activate.bat` output ([#12160](astral-sh/uv#12160)) - Avoid subsequent index hint when no versions are available on the first index ([#9332](astral-sh/uv#9332)) - Error on lockfiles with incoherent wheel versions ([#12235](astral-sh/uv#12235)) ### Rust API - Update `BaseClientBuild` to accept custom proxies ([#12232](astral-sh/uv#12232)) ### Documentation - Make testpypi index explicit in example snippet ([#12148](astral-sh/uv#12148)) - Reverse and format the archived changelogs ([#12099](astral-sh/uv#12099)) - Use consistent commas around i.e. and e.g. ([#12157](astral-sh/uv#12157)) - Fix typos in MRE docs ([#12198](astral-sh/uv#12198)) - Fix double space typo ([#12171](astral-sh/uv#12171))
This is a minimal redux of #10861 to be compatible with
uv pip
.This implements the interface described in: pypa/pip#13065 (comment) for
uv pip install
anduv pip compile
. Namely--group <[path:]name>
, wherepath
when not defined defaults topyproject.toml
.In that interface they add
--group
topip install
,pip download
, andpip wheel
. Notably we do not defineuv pip download
anduv pip wheel
, so for parity we only need to implementuv pip install
. However, we also supportuv pip compile
which is not part of pip itself, and--group
makes sense there too.The behaviour of
--group
foruv pip
commands makes sense for the cases upstream pip supports, but has confusing meanings in cases that only we support (because reading pyproject.tomls is New Tech to them but heavily supported by us). Specifically case (h) below is a concerning footgun, and case (e) below may get complaints from people who aren't well-versed in dependency-groups-as-they-pertain-to-wheels.Only Group Flags
Group flags on their own work reasonably and uncontroversially, except perhaps that they don't do very clever automatic project discovery.
a)
uv pip install --group path/to/pyproject.toml:mygroup
pulls uppath/to/project.toml
and installs all the packages listed by itsmygroup
dependency-group (essentially treating it like another kind of requirements.txt). In this regard it functions similarly to--only-group
in the rest of uv's interface.b)
uv pip install --group mygroup
is just sugar foruv pip install --group pyproject.toml:mygroup
(note that no project discovery occurs, upstream pip simply hardcodes the path "pyproject.toml" here and we reproduce that.)c)
uv pip install --group a/pyproject.toml:groupx --group b/pyproject.toml:groupy
, and any other instance of multiple--group
flags, can be understood as completely independent requests for the given groups at the given files.Groups With Named Packages
Groups being mixed with named packages also work in a fairly unsurprising way, especially if you understand that things like dependency-groups are not really supposed to exist on pypi, they're just for local development.
d)
uv pip install mypackage --group path/to/pyproject.toml:mygroup
much like multiple instances of--group
the two requests here are essentially completely independent: pleases installmypackage
, and please also installpath/to/pyproject.toml:mygroup
.e)
uv pip install mypackage --group mygroup
is exactly the same, but this is where it becomes possible for someone to be a little confused, as you might thinkmygroup
is supposed to refer tomypackage
in some way (it can't). But no, it's sourcingpyproject.toml:mygroup
from the current working directory.Groups With Requirements/Sourcetrees/Editables
Requirements and sourcetrees are where I expect users to get confused. It behaves exactly the same as it does in the previous sections but you would absolutely be forgiven for expecting a different behaviour. Especially because
--group
with the rest of uv does do something different.f)
uv pip install -r a/pyproject.toml --group b/pyproject.toml:mygroup
is again just two independent requests (installa/pyproject.toml
's dependencies, andb/pyproject.toml
'smygroup
).g)
uv pip install -r pyproject.toml --group mygroup
is exactly like the previous case but incidentally the two requests refer to the same file. What the user wanted to happen is almost certainly happening, but they are likely getting "lucky" here that they're requesting something simple.h)
uv pip install -r a/pyproject.toml --group mygroup
is again exactly the same but the user is likely to get surprised and upset as this invocation actually sources two different files (installa/pyproject.toml
's dependencies, andpyproject.toml
'smygroup
)! I would expect most people to assume the--group
flag here is covering all applicable requirements/sourcetrees/editables, but no, it continues to be a totally independent reference to a file with a hardcoded relative path.Fixes #8590
Fixes #8969