Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move build configuration from setup.cfg to pyproject.toml #11

Merged
merged 4 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234)

[flake8]
max-line-length = 100
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include CHANGES.rst
include LICENSE.rst
include CITATION

include setup.cfg
include pyproject.toml

recursive-include docs *
Expand Down
13 changes: 8 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}'

Expand Down
132 changes: 129 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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
zacharyburnett marked this conversation as resolved.
Show resolved Hide resolved
github-project = "spacetelescope/lcviz"
zacharyburnett marked this conversation as resolved.
Show resolved Hide resolved
94 changes: 0 additions & 94 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
sys.exit(1)


setup(use_scm_version={'write_to': 'lcviz/version.py'})
setup()
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down