tox-dev / pre-commit-uv

MIT License
40 stars 1 forks source link

Option to not use uv from pypi? #11

Closed notatallshaw-gts closed 1 week ago

notatallshaw-gts commented 1 week ago

I would like to use the uv I already have installed, rather than have uv installed from pypi.

In particular as I use uv to install pre-commit-uv, it then installs an older version of uv which breaks my workflow.

notatallshaw-gts commented 1 week ago

While this may still be helpful, I realized my reasoning is wrong.

My issue is I was confusing which pre-commit I was using, I was using the one pulled from my local conda environment, not from the one that uv has installed. I should probably clean all pre-commit installs from my Python environments if I am going to switch to the uv tool based workflow.

burgholzer commented 3 days ago

Wondering about something similar: Currently, when running

uv tool install pre-commit --with pre-commit-uv --force-reinstall

this will still install uv from PyPI although uv is (obviously) already present. Would it be an idea to make the uv dependency an optional one so that one would do

uv tool install pre-commit --with pre-commit-uv --force-reinstall

with uv and re-use the present uv, but

pipx install pre-commit
pipx inject pre-commit pre-commit-uv[uv]

when run via pipx, which would install uv?

Happy to provide a PR, if desired.

gaborbernat commented 3 days ago

I disagree with this being a feature. For me this would be a feature that provides endless counts of bugs. With the current state of affairs Upgrading external versions of the UV does not break this tool. For me, having it a separate version is a major feature.

burgholzer commented 2 days ago

Fair enough. Haven't really thought about it from that point of view. Rather from the view of ephemeral build environments like in CI, where these constraints don't matter that much.

Anyway, sorry for the noise.