Skip to content

Commit 7aecdfc

Browse files
SunPyBotCadair
andauthored
Updates from package template (#919)
* Update cruft with batchpr * Fix issues * More fixes * Update ci again * matrix * tweak cron trigger --------- Co-authored-by: Stuart Mumford <[email protected]>
1 parent 48f4140 commit 7aecdfc

8 files changed

Lines changed: 135 additions & 48 deletions

File tree

.cruft.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/sunpy/package-template",
3-
"commit": "4268346dead7b529a3d53df19bcf374bb2bbef34",
3+
"commit": "93c8bc491584f214226a039a35d0cbebe305cd31",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -23,6 +23,7 @@
2323
"include_example_code": "n",
2424
"include_cruft_update_github_workflow": "y",
2525
"use_extended_ruff_linting": "y",
26+
"matrix_room_id": "!TWSJXVpyflnZOzmSQz:matrix.org",
2627
"_sphinx_theme": "sunpy",
2728
"_parent_project": "",
2829
"_install_requires": "",
@@ -32,7 +33,7 @@
3233
".github/workflows/sub_package_update.yml"
3334
],
3435
"_template": "https://github.com/sunpy/package-template",
35-
"_commit": "4268346dead7b529a3d53df19bcf374bb2bbef34"
36+
"_commit": "93c8bc491584f214226a039a35d0cbebe305cd31"
3637
}
3738
},
3839
"directory": null

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
cooldown:
8+
default-days: 7

.github/workflows/ci.yml

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}
2121
cancel-in-progress: true
2222

23+
permissions: {}
24+
2325
jobs:
2426
core:
25-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
27+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
2628
with:
2729
submodules: false
2830
coverage: codecov
@@ -35,8 +37,10 @@ jobs:
3537
sdist_verify:
3638
runs-on: ubuntu-latest
3739
steps:
38-
- uses: actions/checkout@v6
39-
- uses: actions/setup-python@v6
40+
- uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses]
41+
with:
42+
persist-credentials: false
43+
- uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses]
4044
with:
4145
python-version: '3.13'
4246
- run: python -m pip install -U --user build
@@ -46,7 +50,7 @@ jobs:
4650

4751
test:
4852
needs: [core, sdist_verify]
49-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
53+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
5054
with:
5155
submodules: false
5256
coverage: codecov
@@ -63,7 +67,7 @@ jobs:
6367

6468
docs:
6569
needs: [core]
66-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
70+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
6771
with:
6872
default_python: '3.13'
6973
submodules: false
@@ -87,7 +91,7 @@ jobs:
8791
github.event_name == 'pull_request' &&
8892
contains(github.event.pull_request.labels.*.name, 'Run cron CI')
8993
)
90-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
94+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
9195
with:
9296
default_python: '3.13'
9397
submodules: false
@@ -98,7 +102,7 @@ jobs:
98102
secrets:
99103
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
100104

101-
publish:
105+
build_dists:
102106
# Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.*
103107
# see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi
104108
if: |
@@ -108,24 +112,50 @@ jobs:
108112
contains(github.event.pull_request.labels.*.name, 'Run publish')
109113
)
110114
needs: [test, docs]
111-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
115+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2 # zizmor: ignore[unpinned-uses]
112116
with:
113117
python-version: '3.13'
114118
test_extras: 'all,tests'
115119
test_command: 'pytest -p no:warnings --doctest-rst --pyargs ndcube'
116120
submodules: false
117-
secrets:
118-
pypi_token: ${{ secrets.pypi_token }}
121+
save_artifacts: true
122+
upload_to_pypi: false
123+
124+
publish:
125+
if: startsWith(github.ref, 'refs/tags/v')
126+
name: Upload to PyPI
127+
runs-on: ubuntu-latest
128+
needs: [build_dists]
129+
permissions:
130+
id-token: write
131+
environment:
132+
name: pypi
133+
steps:
134+
- name: Download artifacts
135+
uses: actions/download-artifact@v8 # zizmor: ignore[unpinned-uses]
136+
with:
137+
merge-multiple: true
138+
pattern: dist-*
139+
path: dist
140+
141+
- run: ls -lha dist/
142+
143+
- name: Run upload
144+
uses: pypa/[email protected] # zizmor: ignore[unpinned-uses]
119145

120146
notify:
121-
if: always() && github.event_name == 'workflow_dispatch'
122-
needs: [publish, cron]
147+
if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
148+
needs: [build_dists, cron]
123149
runs-on: ubuntu-latest
150+
environment:
151+
name: matrix
124152
steps:
125-
- uses: Cadair/matrix-notify-action@main
153+
- uses: Cadair/matrix-notify-action@main # zizmor: ignore[unpinned-uses]
126154
with:
127-
matrix_token: ${{ secrets.matrix_access_token }}
155+
workflow_description: "CI Workflow"
156+
matrix_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
128157
github_token: ${{ secrets.GITHUB_TOKEN }}
129-
homeserver: ${{ secrets.matrix_homeserver }}
158+
homeserver: ${{ secrets.MATRIX_HOMESERVER }}
130159
roomid: '!TWSJXVpyflnZOzmSQz:matrix.org'
131-
ignore_pattern: '.*Load tox.*'
160+
ignore_pattern: '.*(Load|report overall).*'
161+
summarise_success: true
Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Scheduled builds
1+
name: Scheduled build triggerer
22

33
on:
44
# Allow manual runs through the web UI
@@ -9,13 +9,31 @@ on:
99
# │ │ ┌───────── day of the month (1 - 31)
1010
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
1111
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
12-
- cron: '0 7 * * 1' # Every day at 07:00 UTC
12+
- cron: '0 7 * * 3' # Every Wed at 07:00 UTC
13+
14+
permissions: {}
1315

1416
jobs:
15-
dispatch_workflows:
17+
dispatch_release_branches:
18+
if: github.repository == 'sunpy/ndcube'
19+
permissions:
20+
actions: write
1621
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- branch: "main"
27+
- branch: "2.3"
1728
steps:
18-
- run: gh workflow run ci.yml --repo sunpy/ndcube --ref main
19-
- run: gh workflow run ci.yml --repo sunpy/ndcube --ref 2.3
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
29+
- name: Trigger workflow dispatch for CI workflow
30+
uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1.3.1
31+
with:
32+
workflow: CI
33+
ref: "${{ matrix.branch }}"
34+
35+
- name: Trigger workflow dispatch for Cron workflow
36+
uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1.3.1
37+
with:
38+
workflow: Cron
39+
ref: "${{ matrix.branch }}"

.github/workflows/stale_bot.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
1010
- cron: '0 5 * * *' # Every day at 05:00 UTC
1111

12+
permissions: {}
13+
1214
jobs:
1315
stale:
1416
runs-on: ubuntu-latest
17+
permissions:
18+
issues: write
19+
pull-requests: write
1520
steps:
16-
- uses: actions/stale@v3
21+
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
1722
with:
1823
repo-token: ${{ secrets.GITHUB_TOKEN }}
1924
operations-per-run: 50

.github/workflows/sub_package_update.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ on:
1313
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
1414
- cron: '0 7 * * 1' # Every Monday at 7am UTC
1515

16+
permissions: {}
17+
1618
jobs:
1719
update:
1820
runs-on: ubuntu-latest
1921
permissions:
2022
contents: write
2123
pull-requests: write
22-
strategy:
23-
fail-fast: true
2424
steps:
25-
- uses: actions/checkout@v6
25+
- uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses]
26+
with:
27+
persist-credentials: false
2628

27-
- uses: actions/setup-python@v6
29+
- uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses]
2830
with:
2931
python-version: "3.14"
3032

@@ -50,8 +52,8 @@ jobs:
5052
id: cruft_update
5153
if: steps.check.outputs.has_changes == '1'
5254
run: |
53-
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
54-
git config --global user.name "${{ github.actor }}"
55+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
56+
git config --global user.name "${GITHUB_ACTOR}"
5557
5658
cruft_output=$(cruft update --skip-apply-ask --refresh-private-variables)
5759
echo $cruft_output
@@ -77,7 +79,7 @@ jobs:
7779
7880
- name: Create pull request
7981
if: steps.cruft_json.outputs.has_changes == '1'
80-
uses: peter-evans/create-pull-request@v8
82+
uses: peter-evans/create-pull-request@v8 # zizmor: ignore[unpinned-uses]
8183
with:
8284
token: ${{ secrets.GITHUB_TOKEN }}
8385
add-paths: "."
@@ -103,7 +105,7 @@ jobs:
103105
issues: write
104106
steps:
105107
- name: Open an issue if workflow fails
106-
uses: actions/github-script@v7
108+
uses: actions/github-script@v7 # zizmor: ignore[unpinned-uses]
107109
with:
108110
github-token: ${{ github.token }}
109111
# This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action
@@ -151,7 +153,7 @@ jobs:
151153
repo: variables.name,
152154
body: issue_body,
153155
title: variables.title,
154-
labels: [variables.label],
156+
labels: [variables.label, "pre-commit.ci autofix"],
155157
});
156158
} else {
157159
await github.rest.issues.update({

.pre-commit-config.yaml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,56 @@
11
repos:
2+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
3+
rev: v1.23.1
4+
hooks:
5+
- id: zizmor
26
# This should be before any formatting hooks like isort
37
- repo: https://github.com/astral-sh/ruff-pre-commit
48
rev: "v0.15.4"
59
hooks:
610
- id: ruff
711
args: ["--fix"]
12+
types: [python]
13+
# Define here once and then reference using YAML anchor
14+
exclude: &exclude_dirs ^ndcube/(data|extern)/
815
- repo: https://github.com/PyCQA/isort
916
rev: 8.0.1
1017
hooks:
1118
- id: isort
12-
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|ndcube/extern)$"
19+
types: [python]
20+
exclude: *exclude_dirs
1321
- repo: https://github.com/pre-commit/pre-commit-hooks
1422
rev: v6.0.0
1523
hooks:
1624
- id: check-ast
25+
types: [python]
26+
exclude: *exclude_dirs
1727
- id: check-case-conflict
28+
types: [python]
29+
exclude: *exclude_dirs
1830
- id: trailing-whitespace
19-
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
31+
types_or: [python, rst]
2032
- id: check-yaml
33+
types: [yaml]
34+
exclude: *exclude_dirs
35+
- id: check-toml
36+
types: [toml]
37+
exclude: *exclude_dirs
2138
- id: debug-statements
39+
types: [python]
40+
exclude: *exclude_dirs
2241
- id: check-added-large-files
2342
args: ["--enforce-all", "--maxkb=1054"]
2443
- id: end-of-file-fixer
25-
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
44+
types_or: [python, rst]
2645
- id: mixed-line-ending
27-
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
46+
types_or: [python, rst]
2847
- repo: https://github.com/codespell-project/codespell
2948
rev: v2.4.1
3049
hooks:
3150
- id: codespell
3251
args: [ "--write-changes" ]
52+
types_or: [python, rst]
53+
exclude: *exclude_dirs
3354
ci:
3455
autofix_prs: false
3556
autoupdate_schedule: "quarterly"

README.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,22 @@ For more information or to ask questions about ndcube, check out:
6161
.. _ndcube Documentation: https://docs.sunpy.org/projects/ndcube/
6262
.. _ndcube Chat Channel: https://app.element.io/#/room/#ndcube:openastronomy.org
6363

64+
6465
Contributing
6566
------------
6667

67-
If you would like to get involved, check out the `Newcomers Guide`_ section of the sunpy docs.
68-
This shows how to get setup with a "sunpy" workflow but the same applies for ndcube, you will just need to replace sunpy with ndcube.
68+
We love contributions! ndcube is open source,
69+
built on open source, and we'd love to have you hang out in our community.
6970

71+
If you would like to get involved, check out the `Developers Guide`_ section of the SunPy docs.
72+
Stop by our chat room `#ndcube:openastronomy.org`_ if you have any questions.
7073
Help is always welcome so let us know what you like to work on, or check out the `issues page`_ for the list of known outstanding items.
7174

72-
.. _Newcomers Guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html
73-
.. _issues page: https://github.com/sunpy/ndcube/issues
74-
75-
Code of Conduct
76-
---------------
75+
For more information on contributing to SunPy, please read our `Newcomers' guide`_.
7776

78-
When you are interacting with the SunPy community you are asked to follow our `Code of Conduct`_.
77+
.. _Developers Guide: https://docs.sunpy.org/en/latest/dev_guide/index.html
78+
.. _`#ndcube:openastronomy.org`: https://app.element.io/#/room/#ndcube:openastronomy.org
79+
.. _issues page: https://github.com/sunpy/ndcube/issues
80+
.. _Newcomers' guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html
7981

80-
.. _Code of Conduct: https://sunpy.org/coc
82+
When you are interacting with the SunPy community you are asked at to follow our `code of conduct <https://sunpy.org/coc>`__.

0 commit comments

Comments
 (0)