Skip to content

Commit

Permalink
move build configuration into pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jun 8, 2022
1 parent ab1b46e commit 7f3fd3d
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
key: test-coverage-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }}
- run: pip install ".[test]" pytest-xdist pytest-cov
- run: pip freeze
- run: pytest -n auto --cov-report=xml --cov=src/stcal
- run: pytest -n auto --cov-report=xml --cov=src/stcal --cov-config=pyproject.toml
- run: coverage report -m
- uses: codecov/codecov-action@v2
with:
Expand All @@ -100,7 +100,7 @@ jobs:
- run: pip install ".[test]" pytest-xdist pytest-cov
- run: pip install "jwst[test] @ git+https://github.com/spacetelescope/jwst.git"
- run: pip freeze
- run: pytest -n auto --cov-report=xml --cov=src/stcal --ignore-glob=timeconversion --ignore-glob=associations --pyargs jwst
- run: pytest -n auto --cov-report=xml --cov=src/stcal --cov-config=pyproject.toml --ignore-glob=timeconversion --ignore-glob=associations --pyargs jwst
env:
CRDS_SERVER_URL: https://jwst-crds.stsci.edu
- run: coverage report -m
Expand All @@ -123,7 +123,7 @@ jobs:
- run: pip install ".[test]" pytest-xdist pytest-cov
- run: pip install "romancal[test] @ git+https://github.com/spacetelescope/romancal.git"
- run: pip freeze
- run: pytest -n auto --cov-report=xml --cov=src/stcal --pyargs romancal
- run: pytest -n auto --cov-report=xml --cov=src/stcal --cov-config=pyproject.toml --pyargs romancal
env:
CRDS_SERVER_URL: https://roman-crds-test.stsci.edu
- run: coverage report -m
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

general
-------

- Update CI workflows to cache test environments and depend upon style and security checks [#96]
- Moved build configuration from ``setup.cfg`` to ``pyproject.toml`` to support PEP621 [#95]

0.7.3 (2022-05-20)
==================
Expand Down
19 changes: 8 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from pathlib import Path
import os
import importlib
import sys
from configparser import ConfigParser
from datetime import datetime
import importlib
from pathlib import Path

import sphinx
import stsci_rtd_theme
import toml as toml


def setup(app):
Expand All @@ -20,16 +18,15 @@ def setup(app):

# Modules that automodapi will document need to be available
# in the path:
sys.path.insert(0, str(REPO_ROOT/"src"/"stcal"))
sys.path.insert(0, str(REPO_ROOT / "src" / "stcal"))

# Read the package's setup.cfg so that we can use relevant
# Read the package's `pyproject.toml` so that we can use relevant
# values here:
conf = ConfigParser()
conf.read(REPO_ROOT/"setup.cfg")
setup_metadata = dict(conf.items("metadata"))
conf = toml.load(str(REPO_ROOT / 'pyproject.toml'))
setup_metadata = conf['project']

project = setup_metadata["name"]
author = setup_metadata["author"]
author = setup_metadata["authors"][0]['name']
copyright = f"{datetime.now().year}, {author}"

package = importlib.import_module(setup_metadata["name"])
Expand Down
87 changes: 84 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,87 @@
[project]
name = 'stcal'
description = 'STScI tools and algorithms used in calibration pipelines'
readme = 'README.md'
requires-python = '>=3.7'
license = { file = 'LICENSE' }
authors = [{ name = 'STScI' }]
classifiers = [
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Astronomy',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
]
dependencies = [
'astropy >=5.0.4',
'scipy >=1.6.0',
'numpy >=1.17',
]
dynamic = ['version']

[project.optional-dependencies]
docs = [
'numpydoc',
'packaging >=17',
'sphinx',
'sphinx-astropy',
'sphinx-rtd-theme',
'stsci-rtd-theme',
'toml',
]
lint = [
'pyproject-flake8',
]
test = [
'psutil',
'pytest >=4.6.0',
'pytest-cov',
'pytest-doctestplus',
'pytest-openfiles >=0.5.0',
]

[project.urls]
'repository' = 'https://github.com/spacetelescope/stcal'
'tracker' = 'https://github.com/spacetelescope/stcal/issues'

[build-system]
requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4", "wheel"]
build-backend = "setuptools.build_meta"
requires = [
'setuptools >=42',
'setuptools_scm[toml] >=3.4',
'wheel',
]
build-backend = 'setuptools.build_meta'

[tool.setuptools_scm]
write_to = "src/stcal/_version.py"
write_to = 'src/stcal/_version.py'

[tool.setuptools]
zip-safe = true

[tool.setuptools.packages.find]
where = ['src']

[tool.flake8]
select = ['F', 'W', 'E', 'C']
# We should set max line length lower eventually
max-line-length = 110
exclude = [
'docs',
'build',
'dist',
'.tox',
'.eggs',
]
ignore = [
'E231', # Missing whitespace after ',', ';', or ':'
'E241', # Multiple spaces after ','
'W503', # Line break occurred before a binary operator
'W504', # Line break occurred after a binary operator
]

[tool.pytest]
minversion = 4.6
doctest_plus = true
doctest_rst = true
text_file_format = 'rst'
addopts = '--open-files'

74 changes: 0 additions & 74 deletions setup.cfg

This file was deleted.

0 comments on commit 7f3fd3d

Please sign in to comment.