Skip to content

Commit 47399ce

Browse files
authored
Updates from package template (#119)
* Update cruft with batchpr * Fix doc and oldestdep
1 parent 7ad5332 commit 47399ce

8 files changed

Lines changed: 82 additions & 12 deletions

File tree

.cruft.json

Lines changed: 2 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": "c359c134fbf9e3f11302c2019fb58ac11cf14cdf",
3+
"commit": "164646d882aa2e972d305c54778aaaf35f707464",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -32,7 +32,7 @@
3232
".github/workflows/sub_package_update.yml"
3333
],
3434
"_template": "https://github.com/sunpy/package-template",
35-
"_commit": "c359c134fbf9e3f11302c2019fb58ac11cf14cdf"
35+
"_commit": "164646d882aa2e972d305c54778aaaf35f707464"
3636
}
3737
},
3838
"directory": null

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
sdist_verify:
4444
runs-on: ubuntu-latest
4545
steps:
46-
- uses: actions/checkout@v5
46+
- uses: actions/checkout@v6
4747
- uses: actions/setup-python@v6
4848
with:
4949
python-version: '3.13'

.github/workflows/sub_package_update.yml

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# This template is taken from the cruft example code, for further information please see:
22
# https://cruft.github.io/cruft/#automating-updates-with-github-actions
33
name: Automatic Update from package template
4-
permissions:
5-
contents: write
6-
pull-requests: write
74

85
on:
96
# Allow manual runs through the web UI
@@ -19,14 +16,17 @@ on:
1916
jobs:
2017
update:
2118
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
2222
strategy:
2323
fail-fast: true
2424
steps:
25-
- uses: actions/checkout@v5
25+
- uses: actions/checkout@v6
2626

2727
- uses: actions/setup-python@v6
2828
with:
29-
python-version: "3.11"
29+
python-version: "3.14"
3030

3131
- name: Install Cruft
3232
run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1
@@ -93,3 +93,70 @@ jobs:
9393
If this pull request has been opened as a draft there are conflicts which need fixing.
9494
9595
**To run the CI on this pull request you will need to close it and reopen it.**
96+
97+
report-fail:
98+
if: failure()
99+
needs: [update]
100+
runs-on: ubuntu-latest
101+
permissions:
102+
issues: write
103+
steps:
104+
- name: Open an issue if workflow fails
105+
uses: actions/github-script@v7
106+
with:
107+
github-token: ${{ github.token }}
108+
# This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action
109+
# Under MIT license (c) Scientific Python Developers
110+
script: |
111+
const fs = require('fs');
112+
113+
// Edit these if needed for your repo
114+
const variables = {
115+
owner: context.repo.owner,
116+
name: context.repo.repo,
117+
label: "Infrastructure",
118+
creator: "app/github-actions",
119+
title: "SunPy Package Template auto-update failed."
120+
};
121+
122+
const logs = 'The package update workflow failed.'
123+
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
124+
const issue_body = `[Workflow Run URL](${workflow_url})\n${logs}`;
125+
126+
const query_string = `repo:${variables.owner}/${variables.name} author:${variables.creator} label:${variables.label} is:open in:title ${variables.title}`;
127+
128+
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
129+
const query = `query {
130+
search(query: "${query_string}", type:ISSUE, first: 1) {
131+
edges {
132+
node {
133+
... on Issue {
134+
body
135+
id
136+
number
137+
}
138+
}
139+
}
140+
}
141+
}`;
142+
143+
const result = await github.graphql(query);
144+
145+
// If no issue is open, create a new issue,
146+
// else update the body of the existing issue.
147+
if (result.search.edges.length === 0) {
148+
github.rest.issues.create({
149+
owner: variables.owner,
150+
repo: variables.n ame,
151+
body: issue_body,
152+
title: variables.title,
153+
labels: [variables.label],
154+
});
155+
} else {
156+
github.rest.issues.update({
157+
owner: variables.owner,
158+
repo: variables.name,
159+
issue_number: result.search.edges[0].node.number,
160+
body: issue_body
161+
});
162+
}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
# This should be before any formatting hooks like isort
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: "v0.14.3"
4+
rev: "v0.14.10"
55
hooks:
66
- id: ruff
77
args: ["--fix"]

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"sphinx.ext.napoleon",
4848
"sphinx.ext.doctest",
4949
"sphinx.ext.mathjax",
50+
"sphinx_autodoc_typehints", # After Napoleon and autodoc
5051
"sphinx_automodapi.automodapi",
5152
"sphinx_automodapi.smart_resolver",
5253
"sphinx_changelog",

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies = [
2323
"scipy>=1.12.0",
2424
"streamtracer>=2.2.0",
2525
"sunpy[map]>=7.0.0",
26-
"matplotlib>=3.8.0", # Needed for the oldest deps
26+
"matplotlib>=3.8.0",
2727
]
2828
dynamic = ["version"]
2929

@@ -46,6 +46,7 @@ docs = [
4646
"packaging",
4747
"reproject",
4848
"sphinx-gallery",
49+
"sphinx-autodoc-typehints",
4950
"sunpy[net,map]>=6.0.1,!=6.0.0",
5051
"sunkit-magex[all]",
5152
]

sunkit_magex/pfss/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def car_to_cea(m, method='interp'):
317317

318318

319319
@u.quantity_input
320-
def roll_map(m, lh_edge_lon: u.deg = 0.0 * u.deg, method='interp'):
320+
def roll_map(m, lh_edge_lon: u.Quantity[u.deg] = 0.0 * u.deg, method='interp'):
321321
"""
322322
Roll an input synoptic map so that it's left edge corresponds to a specific
323323
Carrington longitude.
@@ -332,7 +332,7 @@ def roll_map(m, lh_edge_lon: u.deg = 0.0 * u.deg, method='interp'):
332332
----------
333333
m : sunpy.map.GenericMap
334334
Input map
335-
lh_edge_lon : float
335+
lh_edge_lon
336336
Desired Carrington longitude (degrees) for left hand edge of map.
337337
Default is 0.0 which results in a map with the edges at 0/360 degrees
338338
Carrington longitude. Input value must be in the range [0,360]

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ extras =
4444
commands_pre =
4545
oldestdeps: minimum_dependencies sunkit_magex --filename requirements-min.txt
4646
oldestdeps: pip install -r requirements-min.txt
47+
oldestdeps: pip install pyparsing<3.3 # Old version of mpl has an incompatibility
4748
pip freeze --all --no-input
4849
commands =
4950
# To amend the pytest command for different factors you can add a line

0 commit comments

Comments
 (0)