Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell pip to install test dependencies?

We are using pip -e . to install our package in editable/development mode, instead of using python setup.py develop. (We have to do so, because we pull packages from the public PyPi server and a private one. This did not worked for us using python setup.py develop.)

But pip -e . does not install test dependencies and I could not find some flag to force it to do so. How do I install test dependencies using pip?

like image 597
Achim Avatar asked Jan 09 '15 13:01

Achim


People also ask

Does pip install dependencies of dependencies?

Pip will not flag dependency conflicts. As a result, it will happily install multiple versions of a dependency into your project, which will likely result in errors. One way to avoid dependency conflicts is to use an alternative Python package manager, like conda, poetry or ActiveState's State Tool.

How do I get dependencies for pip package?

Pip Check Command – Check Python Dependencies After Installation. Because pip doesn't currently address dependency issues on installation, the pip check command option can be used to verify that dependencies have been installed properly in your project. For example: $ pip check No broken requirements found.


1 Answers

I use extra_require in the setup.py as specified here. For example:

setup(
    name="Project-A",
    ...
    extras_require={
        'develop':  ["mock==2.0.0"],
    }
)

And to execute it using pip install:

pip install -e .[develop]
like image 169
aitorhh Avatar answered Sep 28 '22 10:09

aitorhh