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 Jul 29, 2022
1 parent 066b4da commit 5d989b4
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 84 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: style-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }}
- run: pip install pyproject-flake8
- run: pflake8 --count src
- run: pip install flake8
- run: flake8 --count src
audit:
name: Bandit security audit
runs-on: ubuntu-latest
Expand Down 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
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Changes to API



Other
-----

general
~~~~~~~

- Moved build configuration from ``setup.cfg`` to ``pyproject.toml`` to support PEP621 [#95]

1.0.0 (2022-06-24)
==================

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
66 changes: 63 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
[project]
name = 'stcal'
description = 'STScI tools and algorithms used in calibration pipelines'
readme = 'README.md'
requires-python = '>=3.8'
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',
]
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.pytest]
minversion = 4.6
doctest_plus = true
doctest_rst = true
text_file_format = 'rst'
addopts = '--open-files'

61 changes: 2 additions & 59 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,54 +1,4 @@
[metadata]
name = stcal
description = STScI tools and algorithms used in calibration pipelines
long_description = STScI tools and algorithms used in calibration pipelines
long_description_content_type = text/x-rst
author = STScI
license = BSD-3-Clause
url = https://github.com/spacetelescope/stcal
project_urls =
Bug Tracker = https://github.com/spacetelescope/stcal/issues
Source Code = https://github.com/spacetelescope/stcal
classifiers =
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Astronomy
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3

[options]
zip_safe = True
python_requires = >=3.8
setup_requires =
setuptools_scm
# This requirement forces readthedocs.io to install the
# minimum version of packaging that setuptools_scm needs.
packaging>=17

install_requires =
numpy>=1.17
astropy>=5.0.4
scipy>=1.6.0

package_dir =
=src
packages = find:

[options.packages.find]
where = src

[options.extras_require]
test =
psutil
pytest>=4.6.0
pytest-cov
pytest-doctestplus
pytest-openfiles>=0.5.0
docs =
sphinx
sphinx-automodapi
numpydoc
sphinx-rtd-theme
stsci-rtd-theme
# this file exists to support an editable PEP517 install and for `flake8` (https://github.com/PyCQA/flake8/issues/234)

[flake8]
select = F, W, E, C
Expand All @@ -64,11 +14,4 @@ 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
W504, # Line break occurred after a binary operator
6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

0 comments on commit 5d989b4

Please sign in to comment.