Repository: pypa/setuptools

Issue:
Deprecate and remove 'Features'
Originally reported by: **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**

---

In #58, it comes to my attention that the Features implementation is incomplete and should be removed.

---
- Bitbucket: https://bitbucket.org/pypa/setuptools/issue/65

Deprecate and remove 'Features'
Originally reported by: **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**

---

In #58, it comes to my attention that the Features implementation is incomplete and should be removed.

---
- Bitbucket: https://bitbucket.org/pypa/setuptools/issue/65



Discussion:
_Original comment by_ **zzzeek (Bitbucket: [zzzeek](http://bitbucket.org/zzzeek), GitHub: [zzzeek](http://github.com/zzzeek))**:

---

note: https://bitbucket.org/zzzeek/sqlalchemy/issues/3500/remove-with-out-cextensions-from-installer

_Original comment by_ **marscher (Bitbucket: [marscher](http://bitbucket.org/marscher), GitHub: [marscher](http://github.com/marscher))**:

---

I'am one of the maintainers of Jpype1 and want to distribute a new "Feature", which depends on the presence of Numpy. I need to define a macro and set numpy as additional include_dir for extension building. Currently the setup script checks, if Numpy is importable and sets those things. But by doing so, it's not possible to disable the feature.

So I've tried to define it via extras_require, but then I have no clue how to determine, if setup is being called with "[numpy]" extra or not and change the Distribution class accordingly.

I would really appreciate any hint of solving this problem!
Thanks!

_Original comment by_ **aratto (Bitbucket: [aratto](http://bitbucket.org/aratto), GitHub: [aratto](http://github.com/aratto))**:

---

The link printed out by the warning is broken (missing '/issue/' in path).

Just to provide a new usage example: I am using features to opt-in and install testing dependencies. (setup.py --with-testing develop)

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

In the discussion following the unsuccessful release of 3.0, some use-cases of features were discovered that may not be obviated by use of extras. Namely, extras are always opt-in while features enabled opt-in and opt-out.

Consider SQLAlchemy, which exposes a Feature for it's C-extension speedups. The default build process includes the C-extension and then a particular user or environment can opt-opt with --without-cextension.

The recommended way to use extras for this purpose would be to create a separate package for the c extension, then reference that additional package as an 'extra'. This mechanism, however, would require that users of SQLAlchemy would need to update their requirements to include SQLAlchemy[cext] to retain the default behavior.

There's no way SQLAlchemy to declare that 'cext' is a preferred inclusion or for a user to exclude the dependency explicitly.

On the other hand, having the speedups defined in a separate package gives installer, deployment, and packaging tools more control over which features are present. A tool can quickly assess the presence (or absence) of speedups if they're defined in a separate package.

I think the benefits of using extras outweigh the loss of control with opt-out Features, but I'll explore this concept with the SQLAlchemy project.

Interestingly, every example of the use of Features has been for the inclusion or exclusion of compiled C extensions. Perhaps that's an indication of a different need relating to compiled extensions.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

7306814c7297 re-opens this issue.

_Original comment by_ **haypo (Bitbucket: [haypo](http://bitbucket.org/haypo), GitHub: [haypo](http://github.com/haypo))**:

---

Related issue in OpenStack:
https://review.openstack.org/#/c/78701/

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

The very first link in this ticket to #58 explains the rationale.

_Original comment by_ **mitsuhiko (Bitbucket: [mitsuhiko](http://bitbucket.org/mitsuhiko), GitHub: [mitsuhiko](http://github.com/mitsuhiko))**:

---

Just as a general hint, the following packages are broken through this change:
- SQLAlchemy (it now thinks setuptools is unavailable and installs through distutils)
- MarkupSafe
- PyProtocols
- cffi
- pymongo

And that's just packages I found on a quick github code search.

Why was this change done?

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Removed Features functionality. Fixes #65.

_Original comment by_ **Merwok (Bitbucket: [Merwok](http://bitbucket.org/Merwok), GitHub: [Merwok](http://github.com/Merwok))**:

---

It’s easy to test: use Feature in a setup.py script, run it, see that the warning shows the line from setup.py, not setuptools.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

I set the stacklevel to 3 in 6a7c54c2c48f. I believe that's the most useful stacklevel (although it's difficult to know exactly what stacklevel will be appropriate).

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Excellent idea.

_Original comment by_ **Merwok (Bitbucket: [Merwok](http://bitbucket.org/Merwok), GitHub: [Merwok](http://github.com/Merwok))**:

---

The warnings.warn call should use the stacklevel argument to let Python display the right calling source file.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

In 741d1f64ba40, I've officially deprecated the Features functionality with the intention of removing it in a future release.

Quickly reviewing the aforementioned projects:

- SQLAlchemy dropped the dependency on this feature in 2015
- Markupsafe no longer uses the feature.
- [Pyprotocols still uses it](https://github.com/OnShift/PyProtocols/blob/master/setup.py) but only because it hasn't changed since 2014.
- cffi is no longer using the feature (though I can't tell where it stopped)
- [Pymongo dropped it in 2014](https://github.com/mongodb/mongo-python-driver/commit/29db2e94d84971259b5dfb5dff55dd1b78e7b2f4#diff-2eeaed663bd0d25b7e608891384b7298).

Given the deprecation warning has been loud and obnoxious for half a decade, it's time to remove the functionality.
_Original comment by_ **zzzeek (Bitbucket: [zzzeek](http://bitbucket.org/zzzeek), GitHub: [zzzeek](http://github.com/zzzeek))**:

---

note: https://bitbucket.org/zzzeek/sqlalchemy/issues/3500/remove-with-out-cextensions-from-installer

_Original comment by_ **marscher (Bitbucket: [marscher](http://bitbucket.org/marscher), GitHub: [marscher](http://github.com/marscher))**:

---

I'am one of the maintainers of Jpype1 and want to distribute a new "Feature", which depends on the presence of Numpy. I need to define a macro and set numpy as additional include_dir for extension building. Currently the setup script checks, if Numpy is importable and sets those things. But by doing so, it's not possible to disable the feature.

So I've tried to define it via extras_require, but then I have no clue how to determine, if setup is being called with "[numpy]" extra or not and change the Distribution class accordingly.

I would really appreciate any hint of solving this problem!
Thanks!

_Original comment by_ **aratto (Bitbucket: [aratto](http://bitbucket.org/aratto), GitHub: [aratto](http://github.com/aratto))**:

---

The link printed out by the warning is broken (missing '/issue/' in path).

Just to provide a new usage example: I am using features to opt-in and install testing dependencies. (setup.py --with-testing develop)

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

In the discussion following the unsuccessful release of 3.0, some use-cases of features were discovered that may not be obviated by use of extras. Namely, extras are always opt-in while features enabled opt-in and opt-out.

Consider SQLAlchemy, which exposes a Feature for it's C-extension speedups. The default build process includes the C-extension and then a particular user or environment can opt-opt with --without-cextension.

The recommended way to use extras for this purpose would be to create a separate package for the c extension, then reference that additional package as an 'extra'. This mechanism, however, would require that users of SQLAlchemy would need to update their requirements to include SQLAlchemy[cext] to retain the default behavior.

There's no way SQLAlchemy to declare that 'cext' is a preferred inclusion or for a user to exclude the dependency explicitly.

On the other hand, having the speedups defined in a separate package gives installer, deployment, and packaging tools more control over which features are present. A tool can quickly assess the presence (or absence) of speedups if they're defined in a separate package.

I think the benefits of using extras outweigh the loss of control with opt-out Features, but I'll explore this concept with the SQLAlchemy project.

Interestingly, every example of the use of Features has been for the inclusion or exclusion of compiled C extensions. Perhaps that's an indication of a different need relating to compiled extensions.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

7306814c7297 re-opens this issue.

_Original comment by_ **haypo (Bitbucket: [haypo](http://bitbucket.org/haypo), GitHub: [haypo](http://github.com/haypo))**:

---

Related issue in OpenStack:
https://review.openstack.org/#/c/78701/

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

The very first link in this ticket to #58 explains the rationale.

_Original comment by_ **mitsuhiko (Bitbucket: [mitsuhiko](http://bitbucket.org/mitsuhiko), GitHub: [mitsuhiko](http://github.com/mitsuhiko))**:

---

Just as a general hint, the following packages are broken through this change:
- SQLAlchemy (it now thinks setuptools is unavailable and installs through distutils)
- MarkupSafe
- PyProtocols
- cffi
- pymongo

And that's just packages I found on a quick github code search.

Why was this change done?

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Removed Features functionality. Fixes #65.

_Original comment by_ **Merwok (Bitbucket: [Merwok](http://bitbucket.org/Merwok), GitHub: [Merwok](http://github.com/Merwok))**:

---

It’s easy to test: use Feature in a setup.py script, run it, see that the warning shows the line from setup.py, not setuptools.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

I set the stacklevel to 3 in 6a7c54c2c48f. I believe that's the most useful stacklevel (although it's difficult to know exactly what stacklevel will be appropriate).

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

Excellent idea.

_Original comment by_ **Merwok (Bitbucket: [Merwok](http://bitbucket.org/Merwok), GitHub: [Merwok](http://github.com/Merwok))**:

---

The warnings.warn call should use the stacklevel argument to let Python display the right calling source file.

_Original comment by_ **jaraco (Bitbucket: [jaraco](http://bitbucket.org/jaraco), GitHub: [jaraco](http://github.com/jaraco))**:

---

In 741d1f64ba40, I've officially deprecated the Features functionality with the intention of removing it in a future release.

Quickly reviewing the aforementioned projects:

- SQLAlchemy dropped the dependency on this feature in 2015
- Markupsafe no longer uses the feature.
- [Pyprotocols still uses it](https://github.com/OnShift/PyProtocols/blob/master/setup.py) but only because it hasn't changed since 2014.
- cffi is no longer using the feature (though I can't tell where it stopped)
- [Pymongo dropped it in 2014](https://github.com/mongodb/mongo-python-driver/commit/29db2e94d84971259b5dfb5dff55dd1b78e7b2f4#diff-2eeaed663bd0d25b7e608891384b7298).

Given the deprecation warning has been loud and obnoxious for half a decade, it's time to remove the functionality.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -91,7 +91,6 @@ def pypi_link(pkg_filename):
         ],
         "setuptools.finalize_distribution_options": [
             "parent_finalize = setuptools.dist:_Distribution.finalize_options",
-            "features = setuptools.dist:Distribution._finalize_feature_opts",
             "keywords = setuptools.dist:Distribution._finalize_setup_keywords",
             "2to3_doctests = "
             "setuptools.dist:Distribution._finalize_2to3_doctests",
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -16,7 +16,7 @@
 
 import setuptools.version
 from setuptools.extension import Extension
-from setuptools.dist import Distribution, Feature
+from setuptools.dist import Distribution
 from setuptools.depends import Require
 from . import monkey
 
@@ -24,7 +24,7 @@
 
 
 __all__ = [
-    'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require',
+    'setup', 'Distribution', 'Command', 'Extension', 'Require',
     'SetuptoolsDeprecationWarning',
     'find_packages'
 ]
diff --git a/setuptools/dist.py b/setuptools/dist.py
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -19,9 +19,7 @@
 from collections import defaultdict
 from email import message_from_file
 
-from distutils.errors import (
-    DistutilsOptionError, DistutilsPlatformError, DistutilsSetupError,
-)
+from distutils.errors import DistutilsOptionError, DistutilsSetupError
 from distutils.util import rfc822_escape
 from distutils.version import StrictVersion
 
@@ -32,7 +30,6 @@
 
 from . import SetuptoolsDeprecationWarning
 
-from setuptools.depends import Require
 from setuptools import windows_support
 from setuptools.monkey import get_unpatched
 from setuptools.config import parse_configuration
@@ -338,7 +335,7 @@ def check_packages(dist, attr, value):
 
 
 class Distribution(_Distribution):
-    """Distribution with support for features, tests, and package data
+    """Distribution with support for tests and package data
 
     This is an enhanced version of 'distutils.dist.Distribution' that
     effectively adds the following new optional keyword arguments to 'setup()':
@@ -365,21 +362,6 @@ class Distribution(_Distribution):
         EasyInstall and requests one of your extras, the corresponding
         additional requirements will be installed if needed.
 
-     'features' **deprecated** -- a dictionary mapping option names to
-        'setuptools.Feature'
-        objects.  Features are a portion of the distribution that can be
-        included or excluded based on user options, inter-feature dependencies,
-        and availability on the current system.  Excluded features are omitted
-        from all setup commands, including source and binary distributions, so
-        you can create multiple distributions from the same source tree.
-        Feature names should be valid Python identifiers, except that they may
-        contain the '-' (minus) sign.  Features can be included or excluded
-        via the command line options '--with-X' and '--without-X', where 'X' is
-        the name of the feature.  Whether a feature is included by default, and
-        whether you are allowed to control this from the command line, is
-        determined by the Feature object.  See the 'Feature' class for more
-        information.
-
      'test_suite' -- the name of a test suite to run for the 'test' command.
         If the user runs 'python setup.py test', the package will be installed,
         and the named test suite will be run.  The format is the same as
@@ -401,8 +383,7 @@ class Distribution(_Distribution):
     for manipulating the distribution's contents.  For example, the 'include()'
     and 'exclude()' methods can be thought of as in-place add and subtract
     commands that add or remove packages, modules, extensions, and so on from
-    the distribution.  They are used by the feature subsystem to configure the
-    distribution for the included and excluded features.
+    the distribution.
     """
 
     _DISTUTILS_UNSUPPORTED_METADATA = {
@@ -432,10 +413,6 @@ def __init__(self, attrs=None):
         if not have_package_data:
             self.package_data = {}
         attrs = attrs or {}
-        if 'features' in attrs or 'require_features' in attrs:
-            Feature.warn_deprecated()
-        self.require_features = []
-        self.features = {}
         self.dist_files = []
         # Filter-out setuptools' specific options.
         self.src_root = attrs.pop("src_root", None)
@@ -702,17 +679,6 @@ def parse_config_files(self, filenames=None, ignore_option_errors=False):
                             ignore_option_errors=ignore_option_errors)
         self._finalize_requires()
 
-    def parse_command_line(self):
-        """Process features after parsing command line options"""
-        result = _Distribution.parse_command_line(self)
-        if self.features:
-            self._finalize_features()
-        return result
-
-    def _feature_attrname(self, name):
-        """Convert feature name to corresponding option attribute name"""
-        return 'with_' + name.replace('-', '_')
-
     def fetch_build_eggs(self, requires):
         """Resolve pre-setup requirements"""
         resolved_dists = pkg_resources.working_set.resolve(
@@ -776,53 +742,6 @@ def fetch_build_egg(self, req):
         from setuptools.installer import fetch_build_egg
         return fetch_build_egg(self, req)
 
-    def _finalize_feature_opts(self):
-        """Add --with-X/--without-X options based on optional features"""
-
-        if not self.features:
-            return
-
-        go = []
-        no = self.negative_opt.copy()
-
-        for name, feature in self.features.items():
-            self._set_feature(name, None)
-            feature.validate(self)
-
-            if feature.optional:
-                descr = feature.description
-                incdef = ' (default)'
-                excdef = ''
-                if not feature.include_by_default():
-                    excdef, incdef = incdef, excdef
-
-                new = (
-                    ('with-' + name, None, 'include ' + descr + incdef),
-                    ('without-' + name, None, 'exclude ' + descr + excdef),
-                )
-                go.extend(new)
-                no['without-' + name] = 'with-' + name
-
-        self.global_options = self.feature_options = go + self.global_options
-        self.negative_opt = self.feature_negopt = no
-
-    def _finalize_features(self):
-        """Add/remove features and resolve dependencies between them"""
-
-        # First, flag all the enabled items (and thus their dependencies)
-        for name, feature in self.features.items():
-            enabled = self.feature_is_included(name)
-            if enabled or (enabled is None and feature.include_by_default()):
-                feature.include_in(self)
-                self._set_feature(name, 1)
-
-        # Then disable the rest, so that off-by-default features don't
-        # get flagged as errors when they're required by an enabled feature
-        for name, feature in self.features.items():
-            if not self.feature_is_included(name):
-                feature.exclude_from(self)
-                self._set_feature(name, 0)
-
     def get_command_class(self, command):
         """Pluggable version of get_command_class()"""
         if command in self.cmdclass:
@@ -852,25 +771,6 @@ def get_command_list(self):
                 self.cmdclass[ep.name] = cmdclass
         return _Distribution.get_command_list(self)
 
-    def _set_feature(self, name, status):
-        """Set feature's inclusion status"""
-        setattr(self, self._feature_attrname(name), status)
-
-    def feature_is_included(self, name):
-        """Return 1 if feature is included, 0 if excluded, 'None' if unknown"""
-        return getattr(self, self._feature_attrname(name))
-
-    def include_feature(self, name):
-        """Request inclusion of feature named 'name'"""
-
-        if self.feature_is_included(name) == 0:
-            descr = self.features[name].description
-            raise DistutilsOptionError(
-                descr + " is required, but was excluded or is not available"
-            )
-        self.features[name].include_in(self)
-        self._set_feature(name, 1)
-
     def include(self, **attrs):
         """Add items to distribution that are named in keyword arguments
 
@@ -1115,160 +1015,6 @@ def handle_display_options(self, option_order):
                 sys.stdout.detach(), encoding, errors, newline, line_buffering)
 
 
-class Feature:
-    """
-    **deprecated** -- The `Feature` facility was never completely implemented
-    or supported, `has reported issues
-    <https://github.com/pypa/setuptools/issues/58>`_ and will be removed in
-    a future version.
-
-    A subset of the distribution that can be excluded if unneeded/wanted
-
-    Features are created using these keyword arguments:
-
-      'description' -- a short, human readable description of the feature, to
-         be used in error messages, and option help messages.
-
-      'standard' -- if true, the feature is included by default if it is
-         available on the current system.  Otherwise, the feature is only
-         included if requested via a command line '--with-X' option, or if
-         another included feature requires it.  The default setting is 'False'.
-
-      'available' -- if true, the feature is available for installation on the
-         current system.  The default setting is 'True'.
-
-      'optional' -- if true, the feature's inclusion can be controlled from the
-         command line, using the '--with-X' or '--without-X' options.  If
-         false, the feature's inclusion status is determined automatically,
-         based on 'availabile', 'standard', and whether any other feature
-         requires it.  The default setting is 'True'.
-
-      'require_features' -- a string or sequence of strings naming features
-         that should also be included if this feature is included.  Defaults to
-         empty list.  May also contain 'Require' objects that should be
-         added/removed from the distribution.
-
-      'remove' -- a string or list of strings naming packages to be removed
-         from the distribution if this feature is *not* included.  If the
-         feature *is* included, this argument is ignored.  This argument exists
-         to support removing features that "crosscut" a distribution, such as
-         defining a 'tests' feature that removes all the 'tests' subpackages
-         provided by other features.  The default for this argument is an empty
-         list.  (Note: the named package(s) or modules must exist in the base
-         distribution when the 'setup()' function is initially called.)
-
-      other keywords -- any other keyword arguments are saved, and passed to
-         the distribution's 'include()' and 'exclude()' methods when the
-         feature is included or excluded, respectively.  So, for example, you
-         could pass 'packages=["a","b"]' to cause packages 'a' and 'b' to be
-         added or removed from the distribution as appropriate.
-
-    A feature must include at least one 'requires', 'remove', or other
-    keyword argument.  Otherwise, it can't affect the distribution in any way.
-    Note also that you can subclass 'Feature' to create your own specialized
-    feature types that modify the distribution in other ways when included or
-    excluded.  See the docstrings for the various methods here for more detail.
-    Aside from the methods, the only feature attributes that distributions look
-    at are 'description' and 'optional'.
-    """
-
-    @staticmethod
-    def warn_deprecated():
-        msg = (
-            "Features are deprecated and will be removed in a future "
-            "version. See https://github.com/pypa/setuptools/issues/65."
-        )
-        warnings.warn(msg, DistDeprecationWarning, stacklevel=3)
-
-    def __init__(
-            self, description, standard=False, available=True,
-            optional=True, require_features=(), remove=(), **extras):
-        self.warn_deprecated()
-
-        self.description = description
-        self.standard = standard
-        self.available = available
-        self.optional = optional
-        if isinstance(require_features, (str, Require)):
-            require_features = require_features,
-
-        self.require_features = [
-            r for r in require_features if isinstance(r, str)
-        ]
-        er = [r for r in require_features if not isinstance(r, str)]
-        if er:
-            extras['require_features'] = er
-
-        if isinstance(remove, str):
-            remove = remove,
-        self.remove = remove
-        self.extras = extras
-
-        if not remove and not require_features and not extras:
-            raise DistutilsSetupError(
-                "Feature %s: must define 'require_features', 'remove', or "
-                "at least one of 'packages', 'py_modules', etc."
-            )
-
-    def include_by_default(self):
-        """Should this feature be included by default?"""
-        return self.available and self.standard
-
-    def include_in(self, dist):
-        """Ensure feature and its requirements are included in distribution
-
-        You may override this in a subclass to perform additional operations on
-        the distribution.  Note that this method may be called more than once
-        per feature, and so should be idempotent.
-
-        """
-
-        if not self.available:
-            raise DistutilsPlatformError(
-                self.description + " is required, "
-                "but is not available on this platform"
-            )
-
-        dist.include(**self.extras)
-
-        for f in self.require_features:
-            dist.include_feature(f)
-
-    def exclude_from(self, dist):
-        """Ensure feature is excluded from distribution
-
-        You may override this in a subclass to perform additional operations on
-        the distribution.  This method will be called at most once per
-        feature, and only after all included features have been asked to
-        include themselves.
-        """
-
-        dist.exclude(**self.extras)
-
-        if self.remove:
-            for item in self.remove:
-                dist.exclude_package(item)
-
-    def validate(self, dist):
-        """Verify that feature makes sense in context of distribution
-
-        This method is called by the distribution just before it parses its
-        command line.  It checks to ensure that the 'remove' attribute, if any,
-        contains only valid package/module names that are present in the base
-        distribution when 'setup()' is called.  You may override it in a
-        subclass to perform any other required validation of the feature
-        against a target distribution.
-        """
-
-        for item in self.remove:
-            if not dist.has_contents_for(item):
-                raise DistutilsSetupError(
-                    "%s wants to be able to remove %s, but the distribution"
-                    " doesn't contain any packages or modules under %s"
-                    % (self.description, item, item)
-                )
-
-
 class DistDeprecationWarning(SetuptoolsDeprecationWarning):
     """Class for warning about deprecations in dist in
     setuptools. Not ignored by default, unlike DeprecationWarning."""


Test patch:
diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py
--- a/setuptools/tests/test_setuptools.py
+++ b/setuptools/tests/test_setuptools.py
@@ -4,7 +4,7 @@
 import os
 import distutils.core
 import distutils.cmd
-from distutils.errors import DistutilsOptionError, DistutilsPlatformError
+from distutils.errors import DistutilsOptionError
 from distutils.errors import DistutilsSetupError
 from distutils.core import Extension
 from distutils.version import LooseVersion
@@ -14,7 +14,6 @@
 import setuptools
 import setuptools.dist
 import setuptools.depends as dep
-from setuptools import Feature
 from setuptools.depends import Require
 from setuptools.extern import six
 
@@ -216,86 +215,6 @@ def testInvalidIncludeExclude(self):
             self.dist.exclude(package_dir=['q'])
 
 
-@pytest.mark.filterwarnings('ignore:Features are deprecated')
-class TestFeatures:
-    def setup_method(self, method):
-        self.req = Require('Distutils', '1.0.3', 'distutils')
-        self.dist = makeSetup(
-            features={
-                'foo': Feature(
-                    "foo", standard=True, require_features=['baz', self.req]),
-                'bar': Feature("bar", standard=True, packages=['pkg.bar'],
-                               py_modules=['bar_et'], remove=['bar.ext'],
-                               ),
-                'baz': Feature(
-                    "baz", optional=False, packages=['pkg.baz'],
-                    scripts=['scripts/baz_it'],
-                    libraries=[('libfoo', 'foo/foofoo.c')]
-                ),
-                'dwim': Feature("DWIM", available=False, remove='bazish'),
-            },
-            script_args=['--without-bar', 'install'],
-            packages=['pkg.bar', 'pkg.foo'],
-            py_modules=['bar_et', 'bazish'],
-            ext_modules=[Extension('bar.ext', ['bar.c'])]
-        )
-
-    def testDefaults(self):
-        assert not Feature(
-            "test", standard=True, remove='x', available=False
-        ).include_by_default()
-        assert Feature("test", standard=True, remove='x').include_by_default()
-        # Feature must have either kwargs, removes, or require_features
-        with pytest.raises(DistutilsSetupError):
-            Feature("test")
-
-    def testAvailability(self):
-        with pytest.raises(DistutilsPlatformError):
-            self.dist.features['dwim'].include_in(self.dist)
-
-    def testFeatureOptions(self):
-        dist = self.dist
-        assert (
-            ('with-dwim', None, 'include DWIM') in dist.feature_options
-        )
-        assert (
-            ('without-dwim', None, 'exclude DWIM (default)')
-            in dist.feature_options
-        )
-        assert (
-            ('with-bar', None, 'include bar (default)') in dist.feature_options
-        )
-        assert (
-            ('without-bar', None, 'exclude bar') in dist.feature_options
-        )
-        assert dist.feature_negopt['without-foo'] == 'with-foo'
-        assert dist.feature_negopt['without-bar'] == 'with-bar'
-        assert dist.feature_negopt['without-dwim'] == 'with-dwim'
-        assert ('without-baz' not in dist.feature_negopt)
-
-    def testUseFeatures(self):
-        dist = self.dist
-        assert dist.with_foo == 1
-        assert dist.with_bar == 0
-        assert dist.with_baz == 1
-        assert ('bar_et' not in dist.py_modules)
-        assert ('pkg.bar' not in dist.packages)
-        assert ('pkg.baz' in dist.packages)
-        assert ('scripts/baz_it' in dist.scripts)
-        assert (('libfoo', 'foo/foofoo.c') in dist.libraries)
-        assert dist.ext_modules == []
-        assert dist.require_features == [self.req]
-
-        # If we ask for bar, it should fail because we explicitly disabled
-        # it on the command line
-        with pytest.raises(DistutilsOptionError):
-            dist.include_feature('bar')
-
-    def testFeatureWithInvalidRemove(self):
-        with pytest.raises(SystemExit):
-            makeSetup(features={'x': Feature('x', remove='y')})
-
-
 class TestCommandTests:
     def testTestIsCommand(self):
         test_cmd = makeSetup().get_command_obj('test')