Skip to content

Commit

Permalink
setup.py -> pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Jun 12, 2024
1 parent 20c4397 commit 9892462
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 111 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include README.rst
include CHANGES.rst
include setup.cfg
include LICENSE.rst
include pyproject.toml

Expand Down
101 changes: 97 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" },
]
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",
]
83 changes: 0 additions & 83 deletions setup.cfg

This file was deleted.

22 changes: 1 addition & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ deps =
devdeps: git+https://github.com/exoplanet-dev/celerite2#egg=celerite2

numpy
astropy
celerite2
astropy
matplotlib
PyYAML
scipy
lightkurve
tynt

Expand All @@ -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
Expand Down

0 comments on commit 9892462

Please sign in to comment.