Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify where to install 'tests_require' dependencies of a distribute/setuptools package

When I run python setup.py test the dependencies listed in tests_require in setup.py are downloaded to the current directory. When I run python setup.py install, the dependencies listed in requires are instead installed to site-packages.

How can I have those tests_require dependencies instead installed in site-packages?

like image 644
Danny Navarro Avatar asked Jan 19 '11 10:01

Danny Navarro


People also ask

How do I import setuptools in python?

Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.

Do I need to install setuptools?

you generally don't need to worry about setuptools - either it isn't really needed, or the high-level installers will make sure you have a recent enough version installed; in this last case, as long as the operations they have to do are simple enough generally they won't fail.

Is setuptools installed by default with python?

Even in a vanilla version of Python 3.7. 6 (installed via pyenv ), the packages installed by default are both pip and setuptools .


1 Answers

You cannot specify where the test requirements are installed. The whole point of the tests_require parameter is to specify dependencies that are not required for the installation of the package but only for running the tests (as you can imagine many consumers might want to install the package but not run the tests). If you want the test requirements to be included during installation, I would include them in the install_requires parameter. For example:

test_requirements = ['pytest>=2.1', 'dingus'] setup(     # ...     tests_require = test_requirements,     install_requires = [         # ... (your usual install requirements)     ] + test_requirements, ) 

As far as I know, there's no parameter you can pass to force this behavior without changing the setup script.

like image 84
Jason R. Coombs Avatar answered Sep 20 '22 20:09

Jason R. Coombs