From 03316d81e74239be49463f9e95a9a02e4e565b79 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Jul 18 2019 09:24:18 +0000 Subject: Document run-time deps --- diff --git a/README.md b/README.md index 3e14c00..148b1d8 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,28 @@ And install the wheel in `%install` with `%pyproject_install`: %pyproject_install +Adding run-time and test-time dependencies +------------------------------------------ + +To run tests in the `%check` section, the package's runtime dependencies +often need to also be included as build requirements. +If the project's build system supports the [`prepare-metadata-for-build-wheel` +hook](https://www.python.org/dev/peps/pep-0517/#prepare-metadata-for-build-wheel), +this can be done using the `-r` flag: + + %generate_buildrequires + %pyproject_buildrequires -r + +For projects that specify test requirements using an [`extra` +provide](https://packaging.python.org/specifications/core-metadata/#provides-extra-multiple-use), +these can be added using the `-x` flag. +For example, if upstream suggests installing test dependencies with +`pip install mypackage[testing]`, the test deps would be generated by: + + %generate_buildrequires + %pyproject_buildrequires -r -x testing + + Limitations ----------- @@ -49,6 +71,7 @@ Extras are currently ignored. Some valid Python version specifiers are not supported. +The `-x` flag does not yet support multiple (comma-separated) extras. [PEP 517]: https://www.python.org/dev/peps/pep-0517/ [PEP 518]: https://www.python.org/dev/peps/pep-0518/