From 9892462bfe048a36e51aa76bd66920d7ff5aa48e Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Wed, 12 Jun 2024 14:56:20 -0400 Subject: [PATCH] setup.py -> pyproject --- MANIFEST.in | 1 - pyproject.toml | 101 +++++++++++++++++++++++++++++++++++++++++++++++-- setup.cfg | 83 ---------------------------------------- setup.py | 22 +---------- tox.ini | 6 ++- 5 files changed, 102 insertions(+), 111 deletions(-) delete mode 100644 setup.cfg diff --git a/MANIFEST.in b/MANIFEST.in index 9fa8bfb..c7f2686 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include README.rst include CHANGES.rst -include setup.cfg include LICENSE.rst include pyproject.toml diff --git a/pyproject.toml b/pyproject.toml index 7e7daea..70c8e7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,100 @@ [build-system] +requires = [ + "setuptools", + "setuptools_scm[toml]", + "wheel" +] +build-backend = "setuptools.build_meta" -requires = ["setuptools", - "setuptools_scm", - "wheel"] +[project] +name = "gadfly" +description = "tellar oscillations and granulation" +requires-python = ">=3.11" +readme = { file = "README.rst", content-type = "text/x-rst" } +license = { file = "licenses/LICENSE.rst", content-type = "text/plain" } +authors = [ + { name = "Brett M. Morris", email = "morrisbrettm@gmail.com" }, +] +dependencies = [ + "numpy", + "celerite2", + "astropy", + "matplotlib", + "PyYAML", + "scipy", + "lightkurve", + "tynt", +] +dynamic = ["version"] -build-backend = 'setuptools.build_meta' +[project.optional-dependencies] +test = [ + "pytest", + "pytest-doctestplus", + "pytest-cov", + "scipy", +] +docs = [ + "sphinx", + "sphinx-automodapi", + "scipy", + "lightkurve", + "sphinx-book-theme>=0.3.3", + "numpydoc", +] + +[project.urls] +repository = "https://github.com/bmorris3/gadfly" + +[tool.setuptools] +zip-safe = false +include-package-data = true + +[tool.setuptools.packages.find] + +[tool.setuptools_scm] +write_to = "gadfly/version.py" + +[tool.pytest.ini_options] +testpaths = "gadfly" +#filterwarnings = [ +#] + +[tool.coverage.run] +omit = [ + "gadfly/__init*", + "gadfly/conftest.py", + "gadfly/*setup_package*", + "gadfly/tests/*", + "gadfly/*/tests/*", + "gadfly/extern/*", + "gadfly/version*", + "*/gadfly/__init*", + "*/gadfly/conftest.py", + "*/gadfly/*setup_package*", + "*/gadfly/tests/*", + "*/gadfly/*/tests/*", + "*/gadfly/extern/*", + "*/gadfly/version*", +] + +[tool.coverage.report] +exclude_lines = [ + # Have to re-enable the standard pragma + "pragma: no cover", + # Don't complain about packages we have installed + "except ImportError", + # Don't complain if tests don't hit assertions + "raise AssertionError", + "raise NotImplementedError", + # Don't complain about script hooks + "def main(.*):", + # Ignore branches that don't pertain to this version of Python + "pragma: py{ignore_python_version}", + # Don't complain about IPython completion helper + "def _ipython_key_completions_", + # typing.TYPE_CHECKING is False at runtime + "if TYPE_CHECKING:", + # Ignore typing overloads + "@overload", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cbd3561..0000000 --- a/setup.cfg +++ /dev/null @@ -1,83 +0,0 @@ -[metadata] -name = gadfly -author = Brett M. Morris -author_email = morrisbrettm@gmail.com -license = GNU GPL v3+ -license_file = licenses/LICENSE.rst -url = https://github.com/bmorris3/gadfly -description = Stellar oscillations and granulation -long_description = file: README.rst - -[options] -zip_safe = False -packages = find: -python_requires = >=3.9 -setup_requires = setuptools_scm -install_requires = - numpy - celerite2 - astropy>=4.3 - -[options.extras_require] -all = - matplotlib - PyYAML - scipy - lightkurve - tynt -test = - pytest - pytest-doctestplus - pytest-cov - scipy -docs = - sphinx - sphinx-automodapi - scipy - lightkurve - sphinx-book-theme>=0.3.3 - numpydoc - -[options.package_data] -gadfly = - data/*.ecsv - data/*.json - -[tool:pytest] -testpaths = "gadfly" "docs" -doctest_plus = enabled -text_file_format = rst -addopts = --doctest-rst - -[coverage:run] -omit = - gadfly/__init* - gadfly/conftest.py - gadfly/*setup_package* - gadfly/tests/* - gadfly/*/tests/* - gadfly/extern/* - gadfly/version* - */gadfly/__init* - */gadfly/conftest.py - */gadfly/*setup_package* - */gadfly/tests/* - */gadfly/*/tests/* - */gadfly/extern/* - */gadfly/version* - -[coverage:report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain about packages we have installed - except ImportError - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - # Don't complain about script hooks - def main\(.*\): - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} - # Don't complain about IPython completion helper - def _ipython_key_completions_ diff --git a/setup.py b/setup.py index ecd4480..c823345 100755 --- a/setup.py +++ b/setup.py @@ -1,24 +1,4 @@ #!/usr/bin/env python -# Licensed under a 3-clause BSD style license - see LICENSE.rst - -import os - from setuptools import setup - -VERSION_TEMPLATE = """ -# Note that we need to fall back to the hard-coded version if either -# setuptools_scm can't be imported or setuptools_scm can't determine the -# version, so we catch the generic 'Exception'. -try: - from setuptools_scm import get_version - __version__ = get_version(root='..', relative_to=__file__) -except Exception: - __version__ = '{version}' -""".lstrip() - -setup( - use_scm_version={'write_to': os.path.join('gadfly', 'version.py'), - 'write_to_template': VERSION_TEMPLATE}, - -) +setup() diff --git a/tox.ini b/tox.ini index eeb61f8..3b0dfba 100644 --- a/tox.ini +++ b/tox.ini @@ -36,9 +36,11 @@ deps = devdeps: git+https://github.com/exoplanet-dev/celerite2#egg=celerite2 numpy - astropy celerite2 + astropy matplotlib + PyYAML + scipy lightkurve tynt @@ -49,7 +51,7 @@ extras = commands = pip freeze - pytest --pyargs gadfly {toxinidir}/docs --cov gadfly --cov-config={toxinidir}/setup.cfg {posargs} + pytest --pyargs gadfly {toxinidir}/docs --cov gadfly --cov-config={toxinidir}/pyproject.toml {posargs} [testenv:build_docs] changedir = docs