1. PyPA
  2. Python Packaging Authority Projects
  3. setuptools
Issue #65 open

Deprecate and remove 'Features'

Jason R. Coombs
created an issue

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

Comments (14)

  1. Armin Ronacher

    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?

  2. Jason R. Coombs reporter

    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.

  3. Andrea Ratto

    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)

  4. Martin Scherer

    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!

  5. Log in to comment