diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..6f659a09 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234) + +[flake8] +max-line-length = 100 diff --git a/MANIFEST.in b/MANIFEST.in index 8c1c6e4f..552fd27c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,6 @@ include CHANGES.rst include LICENSE.rst include CITATION -include setup.cfg include pyproject.toml recursive-include docs * diff --git a/docs/conf.py b/docs/conf.py index 7101da98..4225955b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,14 +14,17 @@ import datetime import os -from configparser import ConfigParser from pkg_resources import get_distribution +if sys.version_info < (3, 11): + import tomli as tomllib +else: + import tomllib # -- General configuration ------------------------------------------------ -conf = ConfigParser() -conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')]) -setup_cfg = dict(conf.items('metadata')) +with open(Path(__file__).parent.parent / "pyproject.toml", "rb") as configuration_file: + conf = tomllib.load(configuration_file) +setup_cfg = conf["project"] # Configuration for intersphinx: refer to the Python standard library. # Uncomment if you cross-ref to API doc from other packages. @@ -63,7 +66,7 @@ # General information about the project project = setup_cfg['name'] -author = setup_cfg['author'] +author = setup_cfg['authors'][0]['name'] year = datetime.datetime.now().year copyright = f'{year}, {author}' diff --git a/pyproject.toml b/pyproject.toml index b222b6bb..c61fe2f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,131 @@ +[project] +name = "lcviz" +description = "A Jdaviz-based lightcurve analysis and visualization tool" +requires-python = ">=3.8" +authors = [ + { name = "JDADF Developers", email = "kconroy@stsci.edu" }, +] +keywords = [ + "astronomy", + "astrophysics", +] +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Physics", +] +dependencies = [ + "astropy>=5.2", + "jdaviz", + "lightkurve>=2", +] +dynamic = [ + "version", +] + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[project.license] +file = "LICENSE.rst" +content-type = "text/plain" + +[project.urls] +Homepage = "https://github.com/spacetelescope/lcviz" + +[project.optional-dependencies] +test = [ + "pytest", + "pytest-astropy", + "pytest-tornasync", +] +docs = [ + "sphinx-rtd-theme", + "sphinx-astropy", +] + [build-system] -requires = ["setuptools", - "setuptools_scm", - "wheel"] +requires = [ + "setuptools>=61.2", + "setuptools_scm", + "wheel", +] build-backend = "setuptools.build_meta" + +[tool.setuptools] +zip-safe = false +include-package-data = true +license-files = [ + "LICENSE.rst", +] + +[tool.setuptools.packages.find] +namespaces = false + +[tool.setuptools.package-data] +lcviz = [ + "data/*", + "*.vue", + "plugins/*/*.vue", +] + +[tool.setuptools_scm] +write_to = "lcviz/version.py" + +[tool.pytest.ini_options] +minversion = "5.0" +norecursedirs = [ + "build", + "docs/_build", +] +testpaths = [ + "\"lcviz\"", + "\"docs\"", +] +astropy_header = true +doctest_plus = "enabled" +text_file_format = "rst" +addopts = "--doctest-rst --import-mode=append" +filterwarnings = [ + "error", + "ignore:numpy\\.ndarray size changed:RuntimeWarning", + "ignore:zmq\\.eventloop\\.ioloop is deprecated in pyzmq:DeprecationWarning", + "ignore::DeprecationWarning:glue", + "ignore::DeprecationWarning:bqplot", + "ignore::DeprecationWarning:bqplot_image_gl", + "ignore::DeprecationWarning:bqscales", + "ignore::DeprecationWarning:ipykernel", + "ignore::DeprecationWarning:traittypes", + "ignore::DeprecationWarning:voila", +] + +[tool.coverage.run] +source = [ + "lcviz", +] +omit = [ + "lcviz/tests/*", + "lcviz/version*", + "*/lcviz/tests/*", + "*/lcviz/version*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "except ImportError", + "raise AssertionError", + "raise NotImplementedError", + "def main\\(.*\\):", + "pragma: py{ignore_python_version}", + "def _ipython_key_completions_", +] + +[tool.build_sphinx] +edit_on_github = true +github_project = "spacetelescope/lcviz" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3f079524..00000000 --- a/setup.cfg +++ /dev/null @@ -1,94 +0,0 @@ -[metadata] -name = lcviz -description = A Jdaviz-based lightcurve analysis and visualization tool -long_description = A Jdaviz-based lightcurve analysis and visualization tool -long_description_content_type = text/plain -keywords = astronomy, astrophysics -author = JDADF Developers -author_email = kconroy@stsci.edu -license = BSD -license_file = LICENSE.rst -url = https://github.com/spacetelescope/lcviz -edit_on_github = True -github_project = spacetelescope/lcviz -classifiers = - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Astronomy - Topic :: Scientific/Engineering :: Physics - -[options] -packages = find: -zip_safe = False -setup_requires = - setuptools_scm -install_requires = - astropy>=5.2 - jdaviz - lightkurve>=2 -python_requires = >=3.8 - -[options.extras_require] -test = - pytest - pytest-astropy - pytest-tornasync -docs = - sphinx-rtd-theme - sphinx-astropy - -[options.package_data] -lcviz = - data/* - *.vue - plugins/*/*.vue - -[tool:pytest] -minversion = 5.0 -norecursedirs = build docs/_build -testpaths = "lcviz" "docs" -astropy_header = True -doctest_plus = enabled -text_file_format = rst -addopts = --doctest-rst --import-mode=append -filterwarnings = - error - ignore:numpy\.ndarray size changed:RuntimeWarning - ignore:zmq\.eventloop\.ioloop is deprecated in pyzmq:DeprecationWarning - ignore::DeprecationWarning:glue - ignore::DeprecationWarning:bqplot - ignore::DeprecationWarning:bqplot_image_gl - ignore::DeprecationWarning:bqscales - ignore::DeprecationWarning:ipykernel - ignore::DeprecationWarning:traittypes - ignore::DeprecationWarning:voila - -[flake8] -max-line-length = 100 - -[coverage:run] -source = lcviz -omit = - lcviz/tests/* - lcviz/version* - */lcviz/tests/* - */lcviz/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 0149aaf0..1464421c 100755 --- a/setup.py +++ b/setup.py @@ -31,4 +31,4 @@ sys.exit(1) -setup(use_scm_version={'write_to': 'lcviz/version.py'}) +setup() diff --git a/tox.ini b/tox.ini index 20276784..dbf6b829 100644 --- a/tox.ini +++ b/tox.ini @@ -57,7 +57,7 @@ commands = jupyter --paths pip freeze !cov: pytest --pyargs lcviz {toxinidir}/docs {posargs} - cov: pytest --pyargs lcviz {toxinidir}/docs --cov lcviz --cov-config={toxinidir}/setup.cfg {posargs} + cov: pytest --pyargs lcviz {toxinidir}/docs --cov lcviz --cov-config={toxinidir}/pyproject.toml {posargs} cov: coverage xml -o {toxinidir}/coverage.xml pip_pre =