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

StackOverflow https://stackoverflow.com/questions/18747135

سؤال

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
هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top