Repository: biopython/biopython

Issue:
Updating setup.py to assume and use setuptools
RE: http://mailman.open-bio.org/pipermail/biopython-dev/2017-April/021690.html

> Hello all,
>
> If you are not interested in the packaging details for how we release Biopython, you can stop reading now.
>
> According to https://packaging.python.org/current/ we should recommend using pip for installation (which we now do), and use setuptools to define projects and create Source Distributions (which we no not take advantage of fully).
>
> According to https://packaging.python.org/installing/ we can assume both pip and setuptools are available on Python 2.7.9 and 3.4 onwards (possibly after invoking ensurepip). Note we've deprecated and are likely to soon drop Python 3.3 support [*].
>
> With Biopython 1.69 we included a minimal requirments.txt file which makes it easy to install our numpy dependency but we do not yet specify numpy via install_requires in setup.py - in part because we do not yet assume setuptools will be present. Here's a nice explanation of these two mechanisms and the differing usecases: https://caremad.io/posts/2013/07/setup-vs-requirement/
>
> In short I would like to require setuptools be present for building Biopython, which will let us simply our setup.py file and take advantage of many of the meta-data fields which we currently omit (e.g. classifiers for which versions of Python supported, which gets advertised on PyPI etc).
> 
> Peter
> 
> [*] http://mailman.open-bio.org/pipermail/biopython-dev/2017-April/021674.html



Discussion:
We have now dropped Python 3.3
https://github.com/biopython/biopython/commit/8724f624eb6ac46dbe632ab2b57bee218466c22a

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,21 +1,22 @@
-"""Distutils based setup script for Biopython.
+"""setuptools based setup script for Biopython.
 
-This uses Distutils (http://python.org/sigs/distutils-sig/) the standard
-python mechanism for installing packages. For the easiest installation
-just type the command:
+This uses setuptools which is now the standard python mechanism for
+installing packages. If you have downloaded and uncompressed the
+Biopython source code, or fetched it from git, for the simplest
+installation just type the command::
 
-python setup.py install
+    python setup.py install
+
+However, you would normally install the latest Biopython release from
+the PyPI archive with::
+
+    pip install biopython
 
 For more in-depth instructions, see the installation section of the
 Biopython manual, linked to from:
 
 http://biopython.org/wiki/Documentation
 
-Or for more details about the options available from distutils, look at
-the 'Installing Python Modules' distutils documentation, available from:
-
-http://python.org/sigs/distutils-sig/doc/
-
 Or, if all else fails, feel free to write to the sign up to the Biopython
 mailing list and ask for help.  See:
 
@@ -27,28 +28,21 @@
 import os
 import shutil
 
-if "bdist_wheel" in sys.argv:
-    try:
-        import setuptools
-        import wheel
-    except ImportError:
-        sys.exit("We need both setuptools AND wheel packages installed for bdist_wheel to work")
-    # Import specific bits of setuptools ...
+try:
     from setuptools import setup
     from setuptools import Command
     from setuptools.command.install import install
     from setuptools.command.build_py import build_py
     from setuptools.command.build_ext import build_ext
     from setuptools import Extension
-else:
-    # Except for wheels, stick with standard library's distutils
-    from distutils.core import setup
-    from distutils.core import Command
-    from distutils.command.install import install
-    from distutils.command.build_py import build_py
-    from distutils.command.build_ext import build_ext
-    from distutils.extension import Extension
+except ImportError:
+    sys.exit("We need the Python library setuptools to be installed. Try runnning: python -m ensurepip")
 
+if "bdist_wheel" in sys.argv:
+    try:
+        import wheel
+    except ImportError:
+        sys.exit("We need both setuptools AND wheel packages installed for bdist_wheel to work. Try running: pip install wheel")
 
 _CHECKED = None
 
@@ -505,6 +499,28 @@ def is_Numpy_installed():
     "description": 'Freely available tools for computational molecular biology.',
     "long_description": readme_rst,
     "download_url": 'http://biopython.org/DIST/',
+    "classifiers": [
+        'Development Status :: 5 - Production/Stable',
+        'Intended Audience :: Developers',
+        'Intended Audience :: Science/Research',
+        'License :: Freely Distributable',
+        # Technically the "Biopython License Agreement" is not OSI approved,
+        # but is almost https://opensource.org/licenses/HPND so might put:
+        # 'License :: OSI Approved',
+        # To resolve this we are moving to dual-licensing with 3-clause BSD:
+        # 'License :: OSI Approved :: BSD License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
+        'Topic :: Scientific/Engineering',
+        'Topic :: Scientific/Engineering :: Bio-Informatics',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+    ],
     "cmdclass": {
         "install": install_biopython,
         "build_py": build_py_biopython,


Test patch: