Repository: pypa/setuptools

Issue:
Deprecate requires keyword
See pypa/packaging-problems#3

If I understand correctly, at least the `requires` keyword can be safely deprecated, with its functions distributed (for now) to `setup_requires`, `install_requires` and `test_requires` as appropriate.


Discussion:
The `requires` directive is part of [PEP 314](https://www.python.org/dev/peps/pep-0314/) and implemented primarily in distutils/dist.py. My instinct is if we deprecate `requires`, we may also wish to deprecate `obsoletes` and `provides`, as they were implemented at around the same time... although they don't run into the issue of being in conflict with install_requires.
I want to work on this at the Bloomberg PyPa sprint.

Resolving patch:
diff --git a/setuptools/config.py b/setuptools/config.py
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -2,9 +2,12 @@
 import io
 import os
 import sys
+
+import warnings
 import functools
 from collections import defaultdict
 from functools import partial
+from functools import wraps
 from importlib import import_module
 
 from distutils.errors import DistutilsOptionError, DistutilsFileError
@@ -402,6 +405,20 @@ def parse(self):
 
             section_parser_method(section_options)
 
+    def _deprecated_config_handler(self, func, msg, warning_class):
+        """ this function will wrap around parameters that are deprecated
+        
+        :param msg: deprecation message 
+        :param warning_class: class of warning exception to be raised
+        :param func: function to be wrapped around
+        """
+        @wraps(func)
+        def config_handler(*args, **kwargs):
+            warnings.warn(msg, warning_class)
+            return func(*args, **kwargs)
+        
+        return config_handler
+
 
 class ConfigMetadataHandler(ConfigHandler):
 
@@ -437,7 +454,10 @@ def parsers(self):
             'platforms': parse_list,
             'keywords': parse_list,
             'provides': parse_list,
-            'requires': parse_list,
+            'requires': self._deprecated_config_handler(parse_list,
+                "The requires parameter is deprecated, please use " +
+                "install_requires for runtime dependencies.",
+                DeprecationWarning),
             'obsoletes': parse_list,
             'classifiers': self._get_parser_compound(parse_file, parse_list),
             'license': parse_file,


Test patch:
diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py
--- a/setuptools/tests/test_config.py
+++ b/setuptools/tests/test_config.py
@@ -391,6 +391,23 @@ def test_classifiers(self, tmpdir):
         with get_dist(tmpdir) as dist:
             assert set(dist.metadata.classifiers) == expected
 
+    def test_deprecated_config_handlers(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = 10.1.1\n'
+            'description = Some description\n'
+            'requires = some, requirement\n'
+        )
+
+        with pytest.deprecated_call():
+            with get_dist(tmpdir) as dist:
+                metadata = dist.metadata
+
+                assert metadata.version == '10.1.1'
+                assert metadata.description == 'Some description'
+                assert metadata.requires == ['some', 'requirement']
+
 
 class TestOptions: