uv icon indicating copy to clipboard operation
uv copied to clipboard

How to add extra to a dependency of a tool?

Open grejioh opened this issue 1 year ago • 2 comments

I installed a tool use requests. I want to use requests[socks] instead of the default requests package. I have tried the following commands:

uv tool install open-webui --with requests[socks]
uv tool install open-webui --with requests --optional socks
uv tool upgrade open-webui --reinstall-package requests[socks]
....

Finally, could you please confirm whether it's necessary for uv tool to support adding extras to dependencies?

grejioh avatar Oct 17 '24 02:10 grejioh

uv tool install open-webui --with 'requests[socks]' should work — did it not?

e.g.

❯ uv tool install black --with 'requests[socks]'
Resolved 12 packages in 4ms
Installed 12 packages in 10ms
 + black==24.10.0
 + certifi==2024.8.30
 + charset-normalizer==3.4.0
 + click==8.1.7
 + idna==3.10
 + mypy-extensions==1.0.0
 + packaging==24.1
 + pathspec==0.12.1
 + platformdirs==4.3.6
 + pysocks==1.7.1
 + requests==2.32.3
 + urllib3==2.2.3
Installed 2 executables: black, blackd

zanieb avatar Oct 17 '24 04:10 zanieb

Sort of related: I installed xonsh using uv, then some plugins (xontribs) using xonsh's own manager, which amounts to installing new packages in the environment. Upon xonsh tool upgrade xonsh, it removed these extra packages. Is there a way to specify a list of packages that should be kept in the environment?

Edit: You can edit ~/.local/share/uv/tools/xonsh/uv-receipt.toml to change what packages are included but it's undocumented (so I suspect subject to change) and not the most ergonomic.

LoicGrobol avatar Oct 19 '24 14:10 LoicGrobol

uv tool install open-webui --with 'requests[socks]'

Thank you, I would like to suggest adding this to the documentation.

KaKi87 avatar Apr 23 '25 14:04 KaKi87

https://docs.astral.sh/uv/concepts/tools/#including-additional-dependencies

zanieb avatar Apr 23 '25 14:04 zanieb

Oh, sorry, coming from pipx, I looked up the keyword "inject"...

KaKi87 avatar Apr 23 '25 14:04 KaKi87