Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does python's new 'pip wheel' have any support for building wheels for the dependencies listed in tests_requires?

I use setuptools 'tests_require' to specify dependencies required for testing my package.

tests_require - http://pythonhosted.org/distribute/setuptools.html#new-and-changed-setup-keywords

I have begun using wheel packaging

http://wheel.readthedocs.org/en/latest/

and building a directory of the wheels for my current packages and all their dependencies.

pip wheel --wheel-dir=/tmp/wheelhouse .

However I would like to also build wheels for all the packages listed in any of the packages tests_require.

Obviously I could explicitly specify the requirements in a duplicate test_requirements.txt file:

pip wheel --wheel-dir=/mnt/wheelhouse -r test-requirements.txt

But then I am duplicating the dependencies in both the test requirements file and in the tests_require list. I could read the test requirements file into the tests_require but that seems to be misusing requirements files which to my understanding are intended to allow users to be in control of specifying an environment of packages that are known to work together.

Requirements files - http://www.pip-installer.org/en/latest/cookbook.html
like image 993
Atlas1j Avatar asked Sep 11 '13 17:09

Atlas1j


People also ask

Do Python wheels include dependencies?

Python package installed with pip , e.g. WheelPython dependencies can be specified as dependencies in your packaging, and automatically installed by pip . You can include third party C libraries in wheels, but for sufficiently complex dependencies that won't work.

Does wheel file include dependencies?

whl) files. Wheels are a binary installable format that includes the package and its dependencies. If both sdisk and wheel formats are available on PyPI, pip will prefer a compatible wheel. If pip does not find a wheel to install, it will automatically build a wheel and install it for you.

Does pip have dependencies?

Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.

What does a Python wheel contain?

A Python . whl file is essentially a ZIP ( . zip ) archive with a specially crafted filename that tells installers what Python versions and platforms the wheel will support. A wheel is a type of built distribution.


1 Answers

No, there's no explicit support for this. The easiest way to do this would be to add, an extra to your setup.py:

setup(
    extras_require={
        "test": ["pytest", "your other requirements"],
    },
)

You can of course reuse the same list as for test_requires, then you can pip wheel .[test] and it will make wheels for all of those.

like image 150
Alex Gaynor Avatar answered Oct 13 '22 02:10

Alex Gaynor