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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744744530a4591223.html
评论列表(0条)