Repository: popsim-consortium/stdpopsim (language: python)

Issue:
change from setup.py to setup.cfg and pyproject.toml
Using setup.py is deprecated. Current best practices for Python packaging are to instead use pyproject.toml to indicate what software is needed for building/installing the package (which defaults to `setuptools` if not specified).
https://packaging.python.org/en/latest/tutorials/packaging-projects/

The setuptools folks have finally improved their docs around using pyproject.toml and setup.cfg https://setuptools.pypa.io/en/latest/userguide/index.html

An example of using setup.cfg/pyproject.toml
https://github.com/popsim-consortium/demes-python


Discussion / hints:

Fix patch:
diff --git a/.flake8 b/.flake8
deleted file mode 100644
index a16930e50..000000000
--- a/.flake8
+++ /dev/null
@@ -1,3 +0,0 @@
-[flake8]
-max-line-length = 89
-extend-ignore = E203, W503
diff --git a/README.rst b/README.rst
deleted file mode 100644
index a93338462..000000000
--- a/README.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-
-**Standard library of population genetic simulations**
-
-Stdpopsim is a community-maintained standard library of population genetic models.
-Please see the `documentation <https://popsim-consortium.github.io/stdpopsim-docs/stable/index.html>`_
-for details.
-
-Stdpopsim is highly portable, and provides a number of
-`installation options <https://popsim-consortium.github.io/stdpopsim-docs/stable/installation.html>`_.
-
-To start an interactive Jupyter Notebook and start playing with ``stdpopsim`` now click
-
-.. image:: https://mybinder.org/badge_logo.svg
- :target: https://mybinder.org/v2/gh/popsim-consortium/stdpopsim/main?filepath=stdpopsim_example.ipynb
-
-
-If you use ``stdpopsim`` in your work, please cite our
-`manuscript <https://doi.org/10.1101/2019.12.20.885129>`_ .
-See `here <https://popsim-consortium.github.io/stdpopsim-docs/stable/introduction.html#citations>`__ for
-full citation details.
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 000000000..6eb66c14d
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+# We need setup.cfg support, which setuptools introduced in 30.3.0.
+requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"]
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 000000000..0e95c5e11
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,58 @@
+[metadata]
+name = stdpopsim
+author = PopSim Consortium
+license = GNU GPLv3+
+description = A library of population genetic simulation models
+long_description = file: README.md
+long_description_content_type = text/markdown
+url = https://github.com/popsim-consortium/stdpopsim
+author_email = popgen_benchmark@lists.uoregon.edu #TODO: Change to a better address?
+classifiers =
+    Development Status :: 4 - Beta
+    Intended Audience :: Developers
+    License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
+    Operating System :: POSIX :: Linux
+    Operating System :: Microsoft :: Windows
+    Operating System :: MacOS :: MacOS X
+    Programming Language :: Python :: 3
+    Programming Language :: Python :: 3.7
+    Programming Language :: Python :: 3.8
+    Programming Language :: Python :: 3.9
+    Programming Language :: Python :: 3.10
+    Topic :: Scientific/Engineering
+    Topic :: Scientific/Engineering :: Bio-Informatics
+keywords = simulations, selection, recombination map, models
+project_urls =
+    Documentation = https://popsim-consortium.github.io/stdpopsim-docs/stable/index.html
+    Source Code = https://github.com/popsim-consortium/stdpopsim
+    Bug Tracker = https://github.com/popsim-consortium/stdpopsim/issues
+
+[options]
+packages = stdpopsim
+zip_safe = False
+include_package_data = True
+python_requires = >=3.7
+install_requires =
+    msprime >= 1.0.4
+    attrs >= 19.1.0
+    appdirs
+    humanize
+    pyslim >= 1.0.1
+    pandas
+    zarr
+    numpy
+setup_requires =
+    setuptools
+    setuptools_scm
+
+[options.entry_points]
+console_scripts =
+    stdpopsim = stdpopsim.cli:stdpopsim_main
+
+[flake8]
+max-line-length = 89
+extend-ignore = E203, W503
+
+[tool:pytest]
+addopts = -n 4
+testpaths = tests
diff --git a/setup.py b/setup.py
index c77d244ac..daa14f00d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,56 +1,9 @@
-import os
-import codecs
+#!/usr/bin/env python3
 from setuptools import setup
 
-here = os.path.abspath(os.path.dirname(__file__))
-with codecs.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
-    long_description = f.read()
-
 setup(
+    # Set the name so that github correctly tracks reverse dependencies.
+    # https://github.com/popsim-consortium/stdpopsim/network/dependents
     name="stdpopsim",
-    description="A library of population genetic simulation models",
-    long_description=long_description,
-    author="PopSim Consortium",
-    # TODO probably should have a different email address?
-    author_email="popgen_benchmark@lists.uoregon.edu",
-    classifiers=[
-        "Development Status :: 4 - Beta",
-        "Intended Audience :: Developers",
-        "Topic :: Scientific/Engineering :: Bio-Informatics",
-        "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
-        "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.7",
-        "Programming Language :: Python :: 3.8",
-        "Programming Language :: Python :: 3.9",
-        "Programming Language :: Python :: 3.10",
-    ],
-    keywords="simulations, recombination map, models",
-    packages=["stdpopsim"],
-    include_package_data=True,
-    entry_points={
-        "console_scripts": [
-            "stdpopsim=stdpopsim.cli:stdpopsim_main",
-        ]
-    },
-    python_requires=">=3.7",
-    # NOTE: make sure this is the 'attrs' package, not 'attr'!
-    install_requires=[
-        "msprime>=1.0.4",
-        "attrs>=19.1.0",
-        "appdirs",
-        "humanize",
-        "pyslim>=0.600",
-        "pandas",
-        "zarr",
-        "numpy",
-    ],
-    url="https://github.com/popsim-consortium/stdpopsim",
-    project_urls={
-        "Bug Reports": "https://github.com/popsim-consortium/stdpopsim/issues",
-        "Source": "https://github.com/popsim-consortium/stdpopsim",
-    },
-    license="GNU GPLv3+",
-    platforms=["POSIX", "MacOS X", "Windows"],
-    setup_requires=["setuptools_scm"],
     use_scm_version={"write_to": "stdpopsim/_version.py"},
 )


Test patch:
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index 50b8418b9..000000000
--- a/pytest.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[pytest]
-addopts = -n 4
-testpaths =
-    tests