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 into pyproject.toml #56

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# flake8 does not support pyproject.toml (https://github.com/PyCQA/flake8/issues/234)

[flake8]
select = F, W, E101, E111, E112, E113, E401, E402, E501, E711, E722
# We should set max line length to 88 eventually
max-line-length = 130
exclude =
docs,
src/stpipe/extern,
ignore = E203, W503, W504, W605
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,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
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
methods on the first contained model in a ModelContainer, rather than the
ModelContainer itself [#67]

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

0.4.1 (2022-07-14)
==================

Expand Down
29 changes: 14 additions & 15 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from pathlib import Path
import os
import sys
from configparser import ConfigParser
from datetime import datetime
import importlib

import stsci_rtd_theme
import sys
import tomli
from datetime import datetime
from pathlib import Path


def setup(app):
Expand All @@ -19,19 +17,20 @@ def setup(app):

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

# 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"))
with open(REPO_ROOT / "pyproject.toml", "rb") as configuration_file:
conf = tomli.load(configuration_file)
setup_metadata = conf['project']

project = setup_metadata["name"]
zacharyburnett marked this conversation as resolved.
Show resolved Hide resolved
author = setup_metadata["author"]
copyright = f"{datetime.now().year}, {author}"
primary_author = setup_metadata["authors"][0]
author = f'{primary_author["name"]} <{primary_author["email"]}>'
copyright = f'{datetime.now().year}, {author}'

package = importlib.import_module(setup_metadata["name"])
package = importlib.import_module(project)
version = package.__version__.split("-", 1)[0]
release = package.__version__

Expand All @@ -56,4 +55,4 @@ def setup(app):
# Enable nitpicky mode - which ensures that all references in the docs
# resolve.
nitpicky = True
nitpick_ignore = []
nitpick_ignore = []
73 changes: 70 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,73 @@
[project]
name = 'stpipe'
description = 'Framework for calibration pipeline software'
readme = 'README.md'
requires-python = '>=3.7'
license = { file = 'LICENSE' }
authors = [{ name = 'STScI', email = 'help@stsci.edu' }]
classifiers = [
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Astronomy',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
]
dependencies = [
'asdf>=2.7.1',
'crds>=7.4.1.3',
'astropy>=5.0.4',
'stdatamodels>=0.2.4',
]
dynamic = ['version']

[project.optional-dependencies]
docs = [
'numpydoc',
'sphinx',
'sphinx-automodapi',
'sphinx-rtd-theme',
'stsci-rtd-theme',
'tomli; python_version <"3.11"',
]
test = [
'pytest >=4.6.0',
'pytest-doctestplus',
'pytest-openfiles >=0.5.0',
]

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

[project.entry-points]
asdf_extensions = { stpipe = 'stpipe.integration:StpipeExtension' }
console_scripts = { stpipe = 'stpipe.cli.main:main' }

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

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

[tool.setuptools]
zip-safe = true

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

[tool.pytest.ini_options]
minversion = 4.6
doctest_plus = true
doctest_rst = true
text_file_format = 'rst'
addopts = '--open-files'
norecursedirs = [
'src/stpipe/extern',
]
testpaths = [
'tests',
]
74 changes: 0 additions & 74 deletions setup.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions setup.py

This file was deleted.