admin管理员组文章数量:1391981
I have in the past installed pre-commit using:
pipx install -g pre-commit
I've moved to using uv
now, and I see documentation on the web that says to install something globally, you use almost the same syntax:
uv pip install -g pre-commit
However, when I run that, I get the following error:
❯ uv pip install -g pre-commit
error: unexpected argument '-g' found
tip: to pass '-g' as a value, use '-- -g'
Usage: uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDITABLE>>
For more information, try '--help'.
I've read the tip, but that did not work for me either:
❯ uv pip install -- -g pre-commit
error: Failed to parse: `-g`
Caused by: Expected package name starting with an alphanumeric character, found `-`
-g
Am I thinking about this all wrong? Should I be installing it into a venv that is 'global', in that I usually activate it? Something like a 'dev' venv that I activate in login, and then if a project needs it, it would be in that projects .venv
folder.
My goal is to have it available for all my projects (many non-Python) so that the hooks run.
I have in the past installed pre-commit using:
pipx install -g pre-commit
I've moved to using uv
now, and I see documentation on the web that says to install something globally, you use almost the same syntax:
uv pip install -g pre-commit
However, when I run that, I get the following error:
❯ uv pip install -g pre-commit
error: unexpected argument '-g' found
tip: to pass '-g' as a value, use '-- -g'
Usage: uv pip install [OPTIONS] <PACKAGE|--requirements <REQUIREMENTS>|--editable <EDITABLE>>
For more information, try '--help'.
I've read the tip, but that did not work for me either:
❯ uv pip install -- -g pre-commit
error: Failed to parse: `-g`
Caused by: Expected package name starting with an alphanumeric character, found `-`
-g
Am I thinking about this all wrong? Should I be installing it into a venv that is 'global', in that I usually activate it? Something like a 'dev' venv that I activate in login, and then if a project needs it, it would be in that projects .venv
folder.
My goal is to have it available for all my projects (many non-Python) so that the hooks run.
Share Improve this question edited Mar 13 at 19:02 anthony sottile 70.7k19 gold badges191 silver badges243 bronze badges asked Mar 12 at 15:28 nycyniknycynik 7,5378 gold badges64 silver badges88 bronze badges1 Answer
Reset to default 0It's solvable by having a global python virtual env or installing pre-commit in whatever system python you happen to have.
I choose to have a dev
virtual environment. I created it and then added pre-commit to that, so it's mostly there when I need it.
❯ . ~/.venv/dev/bin/activate
❯ uv pip install pre-commit
Using Python 3.10.12 environment at: /home/mike/.venv/dev
Resolved 9 packages in 197ms
Prepared 2 packages in 146ms
Installed 8 packages in 53ms
+ cfgv==3.4.0
+ distlib==0.3.9
+ filelock==3.17.0
+ identify==2.6.9
+ nodeenv==1.9.1
+ platformdirs==4.3.6
+ pre-commit==4.1.0
+ virtualenv==20.29.3
本文标签: How to install precommit globally with uvStack Overflow
版权声明:本文标题:How to install pre-commit globally with uv - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744744529a2622805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论