Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
a50f09b9
Commit
a50f09b9
authored
Oct 29, 2018
by
Paul Ganssle
Committed by
GitHub
Oct 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1541 from smenon8/deprecate-requires
Deprecate the requires keyword
parents
566f3aad
1c226bde
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
changelog.d/1541.deprecation.rst
changelog.d/1541.deprecation.rst
+1
-0
setuptools/config.py
setuptools/config.py
+21
-1
setuptools/tests/test_config.py
setuptools/tests/test_config.py
+17
-0
No files found.
changelog.d/1541.deprecation.rst
0 → 100644
View file @
a50f09b9
Officially deprecated the ``requires`` parameter in ``setup()``.
setuptools/config.py
View file @
a50f09b9
...
...
@@ -2,9 +2,12 @@ from __future__ import absolute_import, unicode_literals
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 @@ 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
):
...
...
@@ -437,7 +454,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
,
...
...
setuptools/tests/test_config.py
View file @
a50f09b9
...
...
@@ -391,6 +391,23 @@ class TestMetadata:
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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment