Open kdeldycke opened 2 days ago
That API requires that you pass the pyproject.toml directly on the command line, rather than the path to the source tree — since if you’re doing the latter, there’s already standardized syntax for it (putting the extras in brackets).
That API requires that you pass the pyproject.toml directly on the command line, rather than the path to the source tree — since if you’re doing the latter, there’s already standardized syntax for it (putting the extras in brackets).
So there is no way to tell uv
to install all extras, whatever their numbers or IDs?
I tried different ways like:
$ uv pip install ".[*]"
error: Failed to parse: `.[*]`
Caused by: Expected an alphanumeric character starting the extra name, found '*'
.[*]
^
$ uv pip install ".[all]"
Resolved 23 packages in 1.13s
Built meta-package-manager @ file:///Users/kde/meta-package-manager
Prepared 1 package in 797ms
Uninstalled 1 package in 0.93ms
Installed 1 package in 2ms
- meta-package-manager==5.17.0 (from file:///Users/kde/meta-package-manager)
+ meta-package-manager==5.17.0 (from file:///Users/kde/meta-package-manager)
warning: The package `meta-package-manager @ file:///Users/kde/meta-package-manager` does not have an extra named `all`.
The typical thing would be to define an extra called all
in your package, and recursively reference the others, like:
[project]
name = "black"
[project.optional-dependencies]
colorama = ["colorama>=0.4.3"]
uvloop = ["uvloop>=0.15.2"]
all = [
"black[d]",
"black[uvloop]",
]
Oh ok I see. Thanks @charliermarsh for the hint. Now I get it. The all
keyword is more like a convention than a technical feature. And so I'm pretty sure that this is not specified or enforced in any PEP XXX.
Given the diversity of packages I'm likely to stumble upon, and because I'm trying to implement the most generic reusable workflows, I prefer the safety of the --all-extras
parameter.
So for example, my strategy to implement a generic mypy
type checking job, consist in running the following command to get all dependencies installed, including the optional ones from the various typeshed
packages:
$ uv pip install --all-extras ${{ needs.project-metadata.outputs.uv_requirement_params }}
Where needs.project-metadata.outputs.uv_requirement_params
is a variable produce by my gha-utils
CLI:
$ pipx install gha-utils
$ gha-utils metadata
(...)
uv_requirement_params=--requirement pyproject.toml --requirement requirements.txt --requirement requirements/yamllint.txt --requirement requirements/mypy.txt --requirement requirements/format-python.txt --requirement requirements/build.txt --requirement requirements/nuitka.txt --requirement requirements/mdformat.txt --requirement requirements/pipdeptree.txt --requirement requirements/uv.txt --requirement requirements/changelog.txt --requirement requirements/gha-utils.txt
It's quite convoluted, but it works.
Using the latest version of
uv
:When I try to install in my local venv all extras, I get the following error:
Still, I have a
pyproject.toml
at the root, so I expectuv
to use it:This can be reproduced from scratch with my project with the following commands:
This seems to be a follow up of #260.