Skip to content

Commit b893d7a

Browse files
apply template
1 parent 1e989bb commit b893d7a

27 files changed

Lines changed: 1323 additions & 271 deletions

.cruft.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"template": "https://github.com/zacharyburnett/stsci-package-template",
3+
"commit": "d6b6a4304821a9cdbc462ffac106eac75087d513",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"project_name": "stpipe",
8+
"package_name": "stpipe",
9+
"repository_url": "https://github.com/spacetelescope/stpipe",
10+
"project_description": "Provides base classes and command-line tools for implementing calibration pipeline software.",
11+
"manage_changelog_with_towncrier": true,
12+
"publish_docs_to": "readthedocs.io",
13+
"task_runner": "tox",
14+
"python_version": ">=3.10",
15+
"python_c_extensions": false,
16+
"python_build_backend": "hatchling",
17+
"crds_observatory": "none",
18+
"_template": "https://github.com/zacharyburnett/stsci-package-template",
19+
"_commit": "d6b6a4304821a9cdbc462ffac106eac75087d513"
20+
}
21+
},
22+
"directory": "python-package"
23+
}

.github/dependabot.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
version: 2
2-
updates:
32

4-
# Maintain dependencies for GitHub Actions
3+
updates:
54
- package-ecosystem: "github-actions"
6-
directory: "/"
5+
directory: ".github/workflows"
6+
labels:
7+
- no-changelog-entry-needed
78
target-branch: "main"
89
schedule:
9-
interval: "weekly"
10-
reviewers:
11-
- "zacharyburnett"
10+
interval: "monthly"
11+
cooldown:
12+
default-days: 7
13+
groups:
14+
actions:
15+
patterns:
16+
- "*"
1217

13-
# Maintain dependencies for pip
1418
- package-ecosystem: "pip"
1519
directory: "/"
20+
labels:
21+
- no-changelog-entry-needed
1622
target-branch: "main"
1723
schedule:
18-
interval: "weekly"
19-
reviewers:
20-
- "zacharyburnett"
24+
interval: "monthly"
25+
cooldown:
26+
default-days: 7
27+
groups:
28+
actions:
29+
patterns:
30+
- "*"

.github/labeler.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
breaking-change:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- 'changes/*.breaking.rst'
5+
6+
feature:
7+
- changed-files:
8+
- any-glob-to-any-file:
9+
- 'changes/*.feature.rst'
10+
11+
fix:
12+
- changed-files:
13+
- any-glob-to-any-file:
14+
- 'changes/*.fix.rst'
15+
16+
documentation:
17+
- changed-files:
18+
- all-globs-to-any-file: ['*.rst', '!CHANGES.rst', '!changes/*']
19+
- any-glob-to-any-file:
20+
- 'docs/**/*'
21+
- '*.md'
22+
- '.readthedocs.yaml'
23+
- 'LICENSE'
24+
- 'changes/*.docs.rst'
25+
26+
packaging:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- 'pyproject.toml'
30+
31+
# --------------------------------------- testing ---------------------------------------
32+
33+
automation:
34+
- changed-files:
35+
- any-glob-to-any-file:
36+
- '.github/**'
37+
38+
testing:
39+
- changed-files:
40+
- any-glob-to-any-file:
41+
- '**/tests/**'
42+
- '**/regtest/**'
43+
- '.github/workflows/test*.yml'
44+
- '**/conftest.py'

.github/pull_request_template.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
<!-- If this PR closes a JIRA ticket, make sure the title starts with the JIRA issue number,
2-
for example JP-1234: <Fix a bug> -->
3-
Resolves [JP-nnnn](https://jira.stsci.edu/browse/JP-nnnn)
4-
Resolves [RCAL-nnnn](https://jira.stsci.edu/browse/RCAL-nnnn)
1+
<!-- If this PR addresses a JIRA ticket: -->
2+
<!-- Resolves [JP-nnnn](https://jira.stsci.edu/browse/JP-nnnn) -->
53

6-
<!-- If this PR closes a GitHub issue, reference it here by its number -->
7-
Closes #
4+
<!-- If this PR will close an existing GitHub issue (that is not already attached to a JIRA ticket): -->
5+
<!-- Closes # -->
86

9-
<!-- describe the changes comprising this PR here -->
10-
This PR addresses ...
7+
<!-- Describe your changes here: -->
8+
## Description
9+
This change ...
1110

12-
<!-- if you can't perform these tasks due to permissions, please ask a maintainer to do them -->
11+
<!-- If you can't perform these tasks due to permissions, reach out to a maintainer. -->
1312
## Tasks
13+
14+
- [ ] If this change affects user-facing code or public API, add news fragment file(s) to `changes/` (see [the changelog instructions](https://github.com/spacetelescope/stpipe/blob/main/changes/README.md)).
15+
Otherwise, add the `no-changelog-entry-needed` label.
16+
1417
- [ ] update or add relevant tests
1518
- [ ] update relevant docstrings and / or `docs/` page
16-
- [ ] Does this PR change any API used downstream? (if not, label with `no-changelog-entry-needed`)
17-
- [ ] write news fragment(s) in `changes/`: `echo "changed something" > changes/<PR#>.<changetype>.rst` (see [changelog readme](https://github.com/spacetelescope/stpipe/blob/main/changes/README.rst) for instructions)
18-
- [ ] run regression tests with this branch installed (`stpipe@git+https://github.com/<fork>/stpipe.git@<branch>`)
19-
- [ ] [`jwst` regression test](https://github.com/spacetelescope/RegressionTests/actions/workflows/jwst.yml)
20-
- [ ] [`romancal` regression test](https://github.com/spacetelescope/RegressionTests/actions/workflows/romancal.yml)

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
categories:
3+
- title: Breaking Changes
4+
labels:
5+
- breaking-change
6+
- title: New Features
7+
labels:
8+
- feature
9+
- title: Fixes
10+
labels:
11+
- fix
12+
- title: Documentation Changes
13+
labels:
14+
- documentation
15+
- title: Other Changes
16+
labels:
17+
- "*"

.github/workflows/build.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,51 @@
11
name: build
22

33
on:
4+
pull_request:
45
release:
56
types: [released]
6-
pull_request:
77
workflow_dispatch:
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
build:
11-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
12-
with:
13-
upload_to_pypi: ${{ (github.event_name == 'release') && (github.event.action == 'released') }}
14-
secrets:
15-
pypi_token: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }}
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
fetch-tags: true
20+
persist-credentials: false
21+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
22+
with:
23+
# Cache disabled to prevent cache-poisoning attacks on release artifacts.
24+
enable-cache: false
25+
- run: uv build --sdist--wheel
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: dist
29+
path: ./dist/
30+
publish:
31+
needs: [build]
32+
runs-on: ubuntu-latest
33+
permissions:
34+
id-token: write
35+
attestations: write
36+
# Requires environment protection rules in GitHub Settings:
37+
# Settings > Environments > pypi > Add required reviewers
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/stpipe
41+
steps:
42+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
43+
with:
44+
pattern: dist*
45+
path: dist/
46+
merge-multiple: true
47+
- uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
48+
with:
49+
subject-path: "dist/*"
50+
# To upload to PyPI without a token, add this workflow file as a Trusted Publisher in the project settings on the PyPI website
51+
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

.github/workflows/changelog.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
name: changelog
2-
31
on:
4-
pull_request:
2+
pull_request_target:
53
types:
64
- labeled
75
- unlabeled
@@ -10,30 +8,18 @@ on:
108
- reopened
119

1210
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1412
cancel-in-progress: true
1513

1614
jobs:
17-
changelog-check:
15+
check:
1816
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog-entry-needed') }}
1917
runs-on: ubuntu-latest
2018
steps:
21-
- uses: actions/setup-python@v6
22-
with:
23-
python-version: 3.12
24-
- uses: actions/checkout@v6
25-
with:
26-
fetch-depth: 0
27-
- run: pip install .
28-
- run: pip install towncrier
29-
- run: towncrier check
30-
- run: towncrier build --draft | grep -P '#${{ github.event.number }}'
31-
changelog-prevent-manual-edit:
32-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'allow-manual-changelog-edit') }}
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3620
with:
37-
fetch-depth: 0
38-
- name: prevent direct changes to `CHANGES.rst` (write a towncrier fragment in `changes/` instead; you can override this with the `allow-manual-changelog-edit` label)
39-
run: git diff HEAD ${{ github.event.pull_request.base.sha }} --no-patch --exit-code CHANGES.rst
21+
persist-credentials: false
22+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
23+
- run: uv run towncrier check
24+
- name: search for news fragment matching pull request number
25+
run: uv run towncrier build --draft | grep -P '#${{ github.event.number }}'

.github/workflows/label.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on:
2+
pull_request_target:
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
label:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
13+
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request'
14+
with:
15+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/tests.yml

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,55 @@
11
name: tests
22

33
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
410
push:
511
branches:
612
- main
7-
tags:
8-
- "*"
9-
pull_request:
10-
schedule:
11-
# Weekly Monday 9AM build
12-
# * is a special character in YAML so you have to quote this string
13-
- cron: "0 9 * * 1"
1413
workflow_dispatch:
1514

15+
permissions: {}
16+
1617
concurrency:
17-
group: ${{ github.workflow }}-${{ github.ref }}
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1819
cancel-in-progress: true
1920

2021
jobs:
21-
test:
22-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
22+
format:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
28+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
29+
- run: uv run tox -e format
30+
latest_crds_context:
31+
uses: spacetelescope/crds/.github/workflows/contexts.yml@main
2332
with:
24-
envs: |
25-
- linux: py310-oldestdeps-cov-xdist
26-
- linux: py310-xdist
27-
- linux: py311-xdist
28-
- linux: py311-downstreamdeps-cov-xdist
29-
coverage: 'codecov'
30-
- linux: py312-xdist-nolegacypath
31-
- linux: py313-xdist
32-
- linux: py314-cov-xdist
33-
coverage: 'codecov'
34-
- macos: py314-xdist
35-
test_downstream:
36-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
33+
observatory: none
34+
test:
35+
needs:
36+
- latest_crds_context
37+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@ccd2f9f4a24f34ea1165a717af125260d93bb5c1 # v2.6.1
3738
with:
3839
setenv: |
3940
CRDS_PATH: /tmp/data/crds_cache
41+
CRDS_SERVER_URL: ${{ 'https://none-crds.stsci.edu' }}
42+
CRDS_CONTEXT: ${{ needs.latest_crds_context.outputs.context }}
4043
CRDS_CLIENT_RETRY_COUNT: 3
4144
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
45+
cache-path: /tmp/data/crds_cache
46+
cache-key: crds-${{ needs.latest_crds_context.outputs.context }}
47+
artifact-path: |
48+
results.xml
49+
fill: true
50+
fill_platforms: linux
4251
envs: |
43-
- linux: py313-jwst-cov
44-
- linux: py313-romancal-cov
45-
coverage: codecov
52+
- linux: py3-cov
53+
pytest-results-summary: true
54+
coverage: github
55+
- macos: py3

0 commit comments

Comments
 (0)