Repository: graspologic-org/graspologic

Issue:
Only set required dependencies in setup.py
Keeping track of your dependencies in both setup.py and requirements.txt is error prone.  Luckily we have control over that by being able to specify our dependencies for graspologic in setup.py, as well as an extras we may need for development/documentation/whatever purposes in a separate extended section.

requirements.txt can then directly reference this by using the `-e .[devtools]` directive (presuming our extended section's label is 'devtools', that is).  


Discussion:
discussion in #423 and #421 maybe relevant here

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,60 +4,36 @@
 import os
 import sys
 from setuptools import setup, find_packages
-from typing import Tuple
 
 
-def package_metadata() -> Tuple[str, str]:
-    sys.path.insert(0, os.path.join("graspy", "version"))  # TODO: #454 Change path in https://github.com/microsoft/graspologic/issues/454
-    from version import name, version
-    sys.path.pop(0)
+MINIMUM_PYTHON_VERSION = 3, 6  # Minimum of Python 3.6
 
-    version_path = os.path.join("graspy", "version", "version.txt")
-    with open(version_path, "w") as version_file:
-        _b = version_file.write(f"{version}")
-    return name, version
+if sys.version_info < MINIMUM_PYTHON_VERSION:
+    sys.exit("Python {}.{}+ is required.".format(*MINIMUM_PYTHON_VERSION))
 
+sys.path.insert(0, os.path.join("graspy", "version"))
+# TODO: #454 Change path in https://github.com/microsoft/graspologic/issues/454
+from version import version
+sys.path.pop(0)
 
-PACKAGE_NAME, VERSION = package_metadata()
+version_path = os.path.join("graspy", "version", "version.txt")
+with open(version_path, "w") as version_file:
+    version_file.write(f"{version}")
 
-DESCRIPTION = "A set of python modules for graph statistics"
 with open("README.md", "r") as f:
     LONG_DESCRIPTION = f.read()
-AUTHOR = ("Eric Bridgeford, Jaewon Chung, Benjamin Pedigo, Bijan Varjavand",)
-AUTHOR_EMAIL = "j1c@jhu.edu"
-URL = "https://github.com/neurodata/graspy"
-MINIMUM_PYTHON_VERSION = 3, 6  # Minimum of Python 3.6
-REQUIRED_PACKAGES = [
-    "networkx>=2.1",
-    "numpy>=1.8.1",
-    "scikit-learn>=0.19.1",
-    "scipy>=1.4.0",
-    "seaborn>=0.9.0",
-    "matplotlib>=3.0.0",
-    "hyppo>=0.1.3",
-]
-
-
-def check_python_version():
-    """Exit when the Python version is too low."""
-    if sys.version_info < MINIMUM_PYTHON_VERSION:
-        sys.exit("Python {}.{}+ is required.".format(*MINIMUM_PYTHON_VERSION))
-
-
-check_python_version()
 
 setup(
-    name=PACKAGE_NAME,
-    version=VERSION,
-    description=DESCRIPTION,
+    name="graspy",
+    version=version,
+    description="A set of python modules for graph statistics",
     long_description=LONG_DESCRIPTION,
     long_description_content_type="text/markdown",
-    author=AUTHOR,
-    author_email=AUTHOR_EMAIL,
+    author="Eric Bridgeford, Jaewon Chung, Benjamin Pedigo, Bijan Varjavand",
+    author_email="j1c@jhu.edu",
     maintainer="Dwayne Pryce",
     maintainer_email="dwpryce@microsoft.com",
-    install_requires=REQUIRED_PACKAGES,
-    url=URL,
+    url="https://github.com/microsoft/graspologic",
     license="MIT",
     classifiers=[
         "Development Status :: 3 - Alpha",
@@ -70,5 +46,31 @@ def check_python_version():
     ],
     packages=find_packages(exclude=["tests", "tests.*", "tests/*"]),
     include_package_data=True,
-    package_data={'version': [os.path.join('graspy', 'version', 'version.txt')]},  # TODO: #454 Also needs changed by https://github.com/microsoft/graspologic/issues/454,
+    package_data={
+        "version": [os.path.join("graspy", "version", "version.txt")]
+    },  # TODO: #454 Also needs changed by https://github.com/microsoft/graspologic/issues/454
+    install_requires=[
+        "networkx>=2.1",
+        "numpy>=1.8.1",
+        "scikit-learn>=0.19.1",
+        "scipy>=1.4.0",
+        "seaborn>=0.9.0",
+        "matplotlib>=3.0.0,<=3.3.0",
+        "hyppo>=0.1.3",
+    ],
+    extras_require={
+        "dev": [
+            "black",
+            "ipykernel>=5.1.0",
+            "ipython>=7.4.0",
+            "mypy",
+            "nbsphinx",
+            "numpydoc",
+            "pytest",
+            "pytest-cov",
+            "sphinx",
+            "sphinxcontrib-rawfiles",
+            "sphinx-rtd-theme",
+        ]
+    }
 )


Test patch: