Skip to content

Commit 040d06a

Browse files
SunPyBotCadair
andauthored
Updates from package template (#123)
* Cruft update * fix readme --------- Co-authored-by: Stuart Mumford <stuart@cadair.com>
1 parent 17bf0af commit 040d06a

6 files changed

Lines changed: 103 additions & 66 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": "6436220cebd96b3638682023e7149eb78e012fdc",
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": "n",
26+
"matrix_room_id": "!jfEXWJFdXwYnBWsiqk:openastronomy.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": "6436220cebd96b3638682023e7149eb78e012fdc"
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: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ concurrency:
2727
group: ${{ github.workflow }}-${{ github.ref }}
2828
cancel-in-progress: true
2929

30+
permissions: {}
31+
3032
jobs:
3133
core:
32-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
34+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
3335
with:
3436
submodules: false
3537
coverage: codecov
@@ -43,8 +45,10 @@ jobs:
4345
sdist_verify:
4446
runs-on: ubuntu-latest
4547
steps:
46-
- uses: actions/checkout@v6
47-
- uses: actions/setup-python@v6
48+
- uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses]
49+
with:
50+
persist-credentials: false
51+
- uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses]
4852
with:
4953
python-version: '3.13'
5054
- run: python -m pip install -U --user build
@@ -54,7 +58,7 @@ jobs:
5458

5559
test:
5660
needs: [core, sdist_verify]
57-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
61+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
5862
with:
5963
submodules: false
6064
coverage: codecov
@@ -72,7 +76,7 @@ jobs:
7276

7377
docs:
7478
needs: [core]
75-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
79+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses]
7680
with:
7781
default_python: '3.13'
7882
submodules: false
@@ -84,7 +88,7 @@ jobs:
8488
envs: |
8589
- linux: build_docs
8690
87-
publish:
91+
build_dists:
8892
# Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.*
8993
# see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi
9094
if: |
@@ -94,26 +98,50 @@ jobs:
9498
contains(github.event.pull_request.labels.*.name, 'Run publish')
9599
)
96100
needs: [test, docs]
97-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
101+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2 # zizmor: ignore[unpinned-uses]
98102
with:
99103
python-version: '3.13'
100104
test_extras: 'tests'
101105
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunkit_magex'
102106
submodules: false
103-
secrets:
104-
pypi_token: ${{ secrets.pypi_token }}
107+
save_artifacts: true
108+
upload_to_pypi: false
109+
110+
publish:
111+
if: startsWith(github.ref, 'refs/tags/v')
112+
name: Upload to PyPI
113+
runs-on: ubuntu-latest
114+
needs: [build_dists]
115+
permissions:
116+
id-token: write
117+
environment:
118+
name: pypi
119+
steps:
120+
- name: Download artifacts
121+
uses: actions/download-artifact@v8 # zizmor: ignore[unpinned-uses]
122+
with:
123+
merge-multiple: true
124+
pattern: dist-*
125+
path: dist
126+
127+
- run: ls -lha dist/
128+
129+
- name: Run upload
130+
uses: pypa/gh-action-pypi-publish@v1.13.0 # zizmor: ignore[unpinned-uses]
105131

106132
notify:
107-
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
108-
needs: [publish]
133+
if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}
134+
needs: [build_dists]
109135
runs-on: ubuntu-latest
136+
environment:
137+
name: matrix
110138
steps:
111-
- uses: Cadair/matrix-notify-action@main
139+
- uses: Cadair/matrix-notify-action@main # zizmor: ignore[unpinned-uses]
112140
with:
113-
matrix_token: ${{ secrets.matrix_access_token }}
141+
workflow_description: "CI Workflow in sunpy/sunkit-magex"
142+
matrix_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
114143
github_token: ${{ secrets.GITHUB_TOKEN }}
115-
homeserver: ${{ secrets.matrix_homeserver }}
144+
homeserver: ${{ secrets.MATRIX_HOMESERVER }}
116145
roomid: '!jfEXWJFdXwYnBWsiqk:openastronomy.org'
117-
ignore_pattern: '.*Load.*'
146+
ignore_pattern: '.*(Load|report overall).*'
118147
summarise_success: true
119-
workflow_description: 'in sunpy/sunkit-magex'

.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: "."
@@ -102,7 +104,7 @@ jobs:
102104
issues: write
103105
steps:
104106
- name: Open an issue if workflow fails
105-
uses: actions/github-script@v7
107+
uses: actions/github-script@v8 # zizmor: ignore[unpinned-uses]
106108
with:
107109
github-token: ${{ github.token }}
108110
# This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action
@@ -150,7 +152,7 @@ jobs:
150152
repo: variables.name,
151153
body: issue_body,
152154
title: variables.title,
153-
labels: [variables.label],
155+
labels: [variables.label, "pre-commit.ci autofix"],
154156
});
155157
} else {
156158
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 ^sunkit_magex/(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.*|sunkit_magex/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: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,10 @@ Getting Help
2626

2727
For more information or to ask questions about ``sunkit-magex`` or any other SunPy Project package, please check out:
2828

29-
- `SunPy Chat`_
29+
- The `#sunkit-magex:openastronomy.org`_ chat
3030
- `SunPy mailing list <https://groups.google.com/forum/#!forum/sunpy>`__
3131
- `SunPy Community forum <https://community.openastronomy.org/c/sunpy/5>`__
3232

33-
Contributing
34-
------------
35-
36-
The SunPy Project is a community-driven open-source project that welcomes any and all contributions.
37-
Whether you are a developer, student, or user, you can help by contributing code, documentation, or community support.
38-
39-
If you would like to get involved, the `Newcomers Guide`_ guide explains the many different ways to contribute to the SunPy Project and also shows how to get set up with a development workflow.
40-
41-
Help is always welcome, so come and say hello by joining the `SunPy Chat`_ and look over the `Good First Issues list`_ for the ideal places to start.
42-
43-
.. _Newcomers Guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html
44-
.. _Good First Issues list: https://github.com/sunpy/sunpy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22Good+First+Issue%22
45-
.. _SunPy Chat: https://app.element.io/#/room/#sunpy:openastronomy.org
46-
47-
Code of Conduct
48-
---------------
49-
50-
When you are interacting with the SunPy Community you are asked to follow our `Code of Conduct <https://sunpy.org/coc>`__.
51-
5233

5334
Usage of Generative AI
5435
----------------------
@@ -61,22 +42,18 @@ For more information see our documentation on fair and appropriate `AI usage <ht
6142
Contributing
6243
------------
6344

64-
We love contributions! sunkit-magex is open source, built on open source, and we'd love to have you hang out in our community.
65-
66-
**Imposter syndrome disclaimer**: We want your help.
67-
No, really.
45+
We love contributions! sunkit-magex is open source,
46+
built on open source, and we'd love to have you hang out in our community.
6847

69-
There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute.
70-
What could you possibly offer a project like this one?
48+
If you would like to get involved, check out the `Developers Guide`_ section of the SunPy docs.
49+
Stop by our chat room `#sunkit-magex:openastronomy.org`_ if you have any questions.
50+
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.
7151

72-
We assure you - the little voice in your head is wrong.
73-
If you can write code at all, you can contribute code to open source.
74-
Contributing to open source projects is a fantastic way to advance one's coding skills.
75-
Writing perfect code isn't the measure of a good developer (that would disqualify all of us!); it's trying to create something, making mistakes, and learning from those mistakes.
76-
That's how we all improve, and we are happy to help others learn.
52+
For more information on contributing to SunPy, please read our `Newcomers' guide`_.
7753

78-
Being an open source contributor doesn't just mean writing code, either.
79-
You can help out by writing documentation, tests, or even giving feedback about the project (and yes - that includes giving feedback about the contribution process).
80-
Some of these contributions may be the most valuable to the project as a whole, because you're coming to the project with fresh eyes, so you can see the errors and assumptions that seasoned contributors have glossed over.
54+
.. _Developers Guide: https://docs.sunpy.org/en/latest/dev_guide/index.html
55+
.. _`#sunkit-magex:openastronomy.org`: https://app.element.io/#/room/#sunkit-magex:openastronomy.org
56+
.. _issues page: https://github.com/sunpy/sunkit-magex/issues
57+
.. _Newcomers' guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html
8158

82-
Note: This disclaimer was originally written by `Adrienne Lowe <https://github.com/adriennefriend>`_ for a `PyCon talk <https://www.youtube.com/watch?v=6Uj746j9Heo>`_, and was adapted for sunkit-magex based on its use in the README file for the `MetPy project <https://github.com/Unidata/MetPy>`_.
59+
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)