Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

python run pre-commit with -m

Python modules can be run with -m
for example next command for pip

python3.10 -m pip install pre-commit

It allow you to specify exact python binary to use with command (python3.10 or python3.11).

I have successfully installed pre-commit, but got next:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

python3.10 -m pre-commit run         
> python.exe: No module named pre-commit

python3.10 -m precommit run  
> python.exe: No module named precommit

how to run pre-commit via python -m option ?

>Solution :

The module name is pre_commit, not pre-commit (which is the name of the entry point), so you need to run

python -m pre_commit

Note the different names that can be set and do not neccessarily have to be the same:

  1. The name of the PyPi project, which is what you use with pip install
  2. The name of the python module, which is the name used with import from within a script or when you do python -m
  3. The name of an entry-point defined in setup.cfg or an executable that is placed in the bin folder during setup, which is a name that you can directly type in your terminal
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading