Skip to content

Commit

Permalink
move build configuration into pyproject.toml
Browse files Browse the repository at this point in the history
update usage of `setup.cfg` throughout codebase
  • Loading branch information
zacharyburnett committed Aug 9, 2022
1 parent 9051541 commit a826f41
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 142 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/roman_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: style-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml', '**/setup.*') }}
- run: pip install pyproject-flake8
- run: pip install flake8
- run: pip freeze
- run: pflake8
- run: flake8
audit:
name: Bandit security audit
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ flat
----

- Removed try/except condition on Flat Reference file CRDS lookup. [#528]

general
-------

- Update pipeline steps to define the default suffix when saving the step results [#521]

- Simplified reference file name and model storage in dq and flat steps. [#514]

- Update CI workflows to cache test environments and depend upon style and security checks [#511]

- Release ``numpy`` version requirement [#544]

- Moved build configuration from ``setup.cfg`` to ``pyproject.toml`` to support PEP621 [#512]
- Added support for STCAL handing of fully saturated data in both the pipeline and rampfit step. Added a unit test for the rampfit changes and a regression test for the pipeline chages. [#541]

- Update `stpipe` requirement to `>=0.4.2` [#545]
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include README.md
include CHANGES.rst
include setup.cfg
include LICENSE
include pyproject.toml

Expand Down
15 changes: 5 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@

import datetime
import importlib
import sys
import os
import sys
from distutils.version import LooseVersion
from configparser import ConfigParser

import sphinx
import stsci_rtd_theme
import sphinx_astropy
import toml


def setup(app):
Expand All @@ -29,10 +28,6 @@ def setup(app):
except AttributeError:
app.add_stylesheet("stsci.css")


conf = ConfigParser()


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand All @@ -41,8 +36,8 @@ def setup(app):
sys.path.insert(0, os.path.abspath('exts/'))

# -- General configuration ------------------------------------------------
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
setup_cfg = dict(conf.items('metadata'))
conf = toml.load('../pyproject.toml')
setup_cfg = conf['project']

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.3'
Expand Down Expand Up @@ -129,7 +124,7 @@ def check_sphinx_version(expected_version):

# General information about the project
project = setup_cfg['name']
author = setup_cfg['author']
author = setup_cfg['authors'][0]['name']
copyright = '{0}, {1}'.format(datetime.datetime.now().year, author)

# The version info for the project you're documenting, acts as replacement for
Expand Down
136 changes: 131 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,136 @@
[project]
name = 'romancal'
description = 'Library for calibration of science observations from the Nancy Grace Roman Space Telescope'
readme = 'README.md'
requires-python = '>=3.8'
license = { file = 'LICENSE' }
authors = [{ name = 'Roman calibration pipeline developers' }]
classifiers = [
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Astronomy',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
]
dependencies = [
'asdf >=2.11.1',
'astropy >=5.0.4',
'crds >=11.13.1',
'gwcs >=0.18.0',
'jsonschema >=3.0.2',
'numpy >=1.22.3',
'pyparsing >=2.4.7',
'requests >=2.22',
'roman_datamodels >=0.12.3',
#'roman_datamodels @ git+https://github.com/spacetelescope/roman_datamodels.git@main',
'stcal >=0.7.2',
'stpipe >=0.4.2,<1.0',
]
dynamic = ['version']

[project.optional-dependencies]
docs = [
'matplotlib',
'sphinx',
'sphinx-asdf',
'sphinx-astropy',
'sphinx-automodapi',
'sphinx-rtd-theme',
'stsci-rtd-theme',
'toml',
]
lint = [
'pyproject-flake8',
]
test = [
'ci-watson >=0.5.0',
'codecov >=1.6.0',
'pytest >=4.6.0',
'pytest-astropy',
'codecov >=1.6.0',
]
aws = [
'stsci-aws-utils >=0.1.2',
]
ephem = [
'pymssql-linux ==2.1.6',
'jplephem ==2.9',
]

[project.urls]
'tracker' = 'https://github.com/spacetelescope/romancal/issues'
'documentation' = 'https://roman-pipeline.readthedocs.io/en/stable/'
'repository' = 'https://github.com/spacetelescope/romancal'

[project.entry-points]
'stpipe.steps' = { romancal = 'romancal.stpipe.integration:get_steps' }

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

[tool.setuptools_scm]

[tool.setuptools]
zip-safe = false

[tool.setuptools.packages.find]

[tool.setuptools.package-data]
# package_data values are glob patterns relative to each specific subpackage.
'*' = [
'*.fits',
'*.txt',
'*.inc',
'*.cfg',
'*.csv',
'*.yaml',
'*.json',
'*.asdf',
]

[tool.pytest.ini_options]
minversion = 4.6
norecursedirs = [
'docs/_build',
'scripts',
'.tox',
]
asdf_schema_tests_enabled = true
asdf_schema_validate_default = false
asdf_schema_root = 'romancal/datamodels/schemas'
junit_family = 'xunit2'
inputs_root = 'roman-pipeline'
results_root = 'roman-pipeline-results'
doctest_plus = 'enabled'
doctest_rst = 'enabled'
text_file_format = 'rst'
addopts = '--show-capture=no --open-files --doctest-ignore-import-errors'

[tool.coverage]
run = { omit = [
'romancal/regtest/conftest.py',
'romancal/setup.py',
'romancal/tests/test*',
'romancal/regtest/test*',
'romancal/*/tests/*',
'docs/*',
# And list these again for running against installed version
'*/romancal/regtest/conftest.py',
'*/romancal/setup.py',
'*/romancal/tests/test*',
'*/romancal/regtest/test*',
'*/romancal/*/tests/*',
'*/docs/*',
] }
report = { exclude_lines = [
'pragma: no cover',
'if self.debug:',
'except ImportError',
'raise AssertionError',
'raise NotImplementedError',
'if __name__ == "__main__":',
] }
104 changes: 3 additions & 101 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,54 +1,5 @@
[metadata]
name = romancal
description = Library for calibration of science observations from the Nancy Grace Roman Space Telescope
long_description = Library for calibration of science observations from the Nancy Grace Roman Space Telescope
author = Roman calibration pipeline developers
license = BSD-3-Clause
url = https://github.com/spacetelescope/romancal
project_urls =
Bug Tracker = https://github.com/spacetelescope/romancal/issues
Documentation = https://roman-pipeline.readthedocs.io/en/stable/
Source Code = https://github.com/spacetelescope/romancal
classifiers =
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Astronomy
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3

[options]
zip_safe = False
python_requires = >=3.8
setup_requires =
setuptools_scm
install_requires =
asdf>=2.11.1
astropy>=5.0.4
crds>=11.13.1
gwcs>=0.18.1
jsonschema>=3.0.2
numpy
pyparsing>=2.4.7
requests>=2.22
roman_datamodels>=0.12.3
#roman_datamodels @ git+https://github.com/spacetelescope/roman_datamodels.git@main
stcal>=0.7.2
stpipe>=0.4.2,<1.0


[options.extras_require]
docs =
matplotlib
sphinx
sphinx-automodapi
sphinx-rtd-theme
stsci-rtd-theme
sphinx-astropy
sphinx-asdf
test =
ci-watson>=0.3.0
pytest>=4.6.0
pytest-astropy
codecov>=1.6.0
# this file exists to support an editable PEP517 install and for `flake8` (https://github.com/PyCQA/flake8/issues/234)
# and `sphinx` configuration

[flake8]
select = F, W, E27, E70, E71, E101, E111, E112, E113, E201, E202, E221, E222,
Expand All @@ -60,60 +11,11 @@ exclude =
.eggs
ignore = E203, W503, W504

aws =
stsci-aws-utils>=0.1.2
ephem =
pymssql-linux==2.1.6
jplephem==2.9

[options.entry_points]
stpipe.steps =
romancal = romancal.stpipe.integration:get_steps

[build-sphinx]
source-dir = docs
build-dir = docs
all_files = 1

[upload_docs]
upload-dir = docs/_build/html
show-response = 1

[tool:pytest]
minversion = 4.6
norecursedirs = docs/_build scripts .tox
asdf_schema_tests_enabled = true
asdf_schema_validate_default = false
asdf_schema_root = romancal/datamodels/schemas
junit_family = xunit2
inputs_root = roman-pipeline
results_root = roman-pipeline-results
doctest_plus = true
doctest_rst = true
text_file_format = rst
addopts = --show-capture=no --open-files --doctest-ignore-import-errors

[coverage:run]
omit =
romancal/regtest/conftest.py
romancal/setup.py
romancal/tests/test*
romancal/regtest/test*
romancal/*/tests/*
docs/*
# And list these again for running against installed version
*/romancal/regtest/conftest.py
*/romancal/setup.py
*/romancal/tests/test*
*/romancal/regtest/test*
*/romancal/*/tests/*
*/docs/*

[coverage:report]
exclude_lines =
pragma: no cover
if self.debug:
except ImportError
raise AssertionError
raise NotImplementedError
if __name__ == '__main__':
show-response = 1
21 changes: 2 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
from os.path import basename
from setuptools import setup, find_packages
from glob import glob
from os.path import basename

from setuptools import setup

NAME = 'romancal'

SCRIPTS = [s for s in glob('scripts/*') if basename(s) != '__pycache__']

PACKAGE_DATA = {
'': [
'*.fits',
'*.txt',
'*.inc',
'*.cfg',
'*.csv',
'*.yaml',
'*.json',
'*.asdf'
]
}

setup(
use_scm_version=True,
setup_requires=['setuptools_scm'],
scripts=SCRIPTS,
packages=find_packages(),
package_data=PACKAGE_DATA,
)

0 comments on commit a826f41

Please sign in to comment.