Ignore specific packages and their dependencies with stopping the loop

The name basically says it all. How can I say pip freezeignore certain packages, for example pylintand pep8, and their dependencies?

+4
source share
3 answers

Several options available

Try simple ignorance

It is simply not necessary that these packages be present in the output pip.

Remove these lines from output

Filter the output through some filter grepand get the result clean.

Use virtualenv and do not install unwanted packages into it

, virtualenv ( argparse wsgiref - .)

pipwarm

( ).

, , , , , , , virtualenv , , - pip.

pep8 pylint ,

, pylint pep8, , pip freeze,

pep8 pylint virtualenv /usr/bin

pylint pep8 virtualenv, which pep8 which pylint -, , . /usr/bin. , virtualenv, python virtualenv ( , ). , virutalenv, .

pep8 pylint , virtualenv

, . pip freeze virtualenv.

+3

:

  • my .bashrc : alias pipfreezeignore='pip freeze | grep -vFxf ignore_requirements.txt'
  • , (.. pip install jedi flake8 importmagic autopep8 yapf).
  • ignore_requirements.txt, pip freeze > ignore_requirements.txt.
  • (, pip install django)
  • pipfreezeignore > requirements.txt ( , ignore_requirements.txt), requirements.txt , ignore_requirements.txt

( ), , alias pipfreezeignore='pip freeze | grep -vFxf /abs/path/to/ignore_requirements.txt' , ignore_requirements.txt.

+2

in windows with powershell:

 $exclude = 'pylint', 'pep8'  

 pip freeze |  
             Where-Object { $exclude -notcontains $_ } |  
             ForEach-Object { pip install --upgrade $_ }
+1
source

Source: https://habr.com/ru/post/1540430/


All Articles