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
Test requirements won't be recorded in wheel until the JSON Metadata 2.0 is available (probably not until next year at least). It is also fairly common for packages to not install their unit tests in which case the wheel would not contain tests and you would have to go back to the sdist.
I agree that most packages intended for deployment won't want to contain test dependencies. My interest stems from the need to extract install and test requirements as part of our automated build and test environment.
FYI bdist_wheel already includes a draft Metadata 2.0 "pydist.json" in
the dist-info directory. It probably has some bugs and the format
definitely will change, but it does include the test requirements:
"test_requires": [
{
"requires": [
"jsonschema",
"pytest",
"coverage",
"pytest-cov"
]
}
],
On Thu, Sep 12, 2013, at 09:08 AM, Steven Bauer wrote:
I agree that most packages intended for deployment won't want to
contain test dependencies. My interest stems from the need to
extract install and test requirements as part of our automated build
and test environment.
—
Reply to this email directly or [1]view it on GitHub.
[jRB-KP9-4apGOUr1-hoPd1QyCsQog2_Fvp1nJYyMmgzQdjRyEHTmTqUr6J0FZxZi.gif]
References
+1
+1
A better way to specify test requirements is to use { 'extras_require' : { 'test': ['requirement1', 'requirement2'] } }
Then the dedicated test_requires can ask for yourpackage[test] or you can just pip install yourpackage[test] when you want.
This is not currently possible to do since setuptools doesn't exist this information. The extras mechanism that was indicated above is the correct way to handle this on pip.
Most helpful comment
A better way to specify test requirements is to use { 'extras_require' : { 'test': ['requirement1', 'requirement2'] } }
Then the dedicated test_requires can ask for yourpackage[test] or you can just pip install yourpackage[test] when you want.