diff options
author | Sreejith Menon <sreejith_1729@yahoo.co.in> | 2018-10-27 10:29:08 -0700 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-10-27 18:13:15 -0400 |
commit | a6a5040ae14b74bfaaaf835d57129ee7618e5cfd (patch) | |
tree | f736604366ae37147285acb6d9c5e61fda92d03d /setuptools/config.py | |
parent | fb84b3fdfd6d4e010d8397efacf4388ee418da7f (diff) | |
download | external_python_setuptools-a6a5040ae14b74bfaaaf835d57129ee7618e5cfd.tar.gz external_python_setuptools-a6a5040ae14b74bfaaaf835d57129ee7618e5cfd.tar.bz2 external_python_setuptools-a6a5040ae14b74bfaaaf835d57129ee7618e5cfd.zip |
Deprecate the requires keyword
For runtime dependencies, install_requires should be used. For build
dependencies, a PEP 518-compliant `pyproject.toml` should be used.
Other dependencies can use extra requirements.
Diffstat (limited to 'setuptools/config.py')
-rw-r--r-- | setuptools/config.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/setuptools/config.py b/setuptools/config.py index 73a3bf70..1f9c50f9 100644 --- a/setuptools/config.py +++ b/setuptools/config.py @@ -2,8 +2,10 @@ from __future__ import absolute_import, unicode_literals import io import os import sys +import warnings from collections import defaultdict from functools import partial +from functools import wraps from importlib import import_module from distutils.errors import DistutilsOptionError, DistutilsFileError @@ -399,6 +401,20 @@ class ConfigHandler: 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): @@ -434,7 +450,10 @@ class ConfigMetadataHandler(ConfigHandler): '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, |