Skip to content

Commit 18e30ad

Browse files
CadairsamaloneyCopilot
authored
Bump minimum python and dependancies (#234)
* Update cruft with batchpr * bump * Spec 0 bumps * rtd python bump * ruff * more updates * Update RTD env for sqlite error * Update numdifftools version and filtered warnings * Add breaking changelog. * Update .github/workflows/sub_package_update.yml Copilot typo fix Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Shane Maloney <[email protected]> Co-authored-by: Shane Maloney <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 123fd67 commit 18e30ad

File tree

12 files changed

+120
-43
lines changed

12 files changed

+120
-43
lines changed

.cruft.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/sunpy/package-template",
3-
"commit": "2d254ec79b0b2d9dfb8d7d08ebd83fa6da234b46",
3+
"commit": "164646d882aa2e972d305c54778aaaf35f707464",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -17,7 +17,7 @@
1717
"changelog_url": "",
1818
"issue_tracker_url": "",
1919
"license": "BSD 3-Clause",
20-
"minimum_python_version": "3.10",
20+
"minimum_python_version": "3.12",
2121
"use_compiled_extensions": "n",
2222
"enable_dynamic_dev_versions": "y",
2323
"include_example_code": "n",
@@ -32,7 +32,7 @@
3232
".github/workflows/sub_package_update.yml"
3333
],
3434
"_template": "https://github.com/sunpy/package-template",
35-
"_commit": "2d254ec79b0b2d9dfb8d7d08ebd83fa6da234b46"
35+
"_commit": "164646d882aa2e972d305c54778aaaf35f707464"
3636
}
3737
},
3838
"directory": null

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ jobs:
4242
sdist_verify:
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v4
46-
- uses: actions/setup-python@v5
45+
- uses: actions/checkout@v5
46+
- uses: actions/setup-python@v6
4747
with:
48-
python-version: '3.12'
48+
python-version: '3.13'
4949
- run: python -m pip install -U --user build
5050
- run: python -m build . --sdist
5151
- run: python -m pip install -U --user twine
@@ -60,18 +60,19 @@ jobs:
6060
toxdeps: tox-pypi-filter
6161
posargs:
6262
envs: |
63-
- windows: py311
63+
- linux: py314
64+
- windows: py312
6465
- macos: py312
65-
- linux: py310-oldestdeps
66-
- linux: py313-devdeps
66+
- linux: py312-oldestdeps
67+
- linux: py314-devdeps
6768
secrets:
6869
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6970

7071
docs:
7172
needs: [core]
7273
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
7374
with:
74-
default_python: '3.12'
75+
default_python: '3.13'
7576
submodules: false
7677
pytest: false
7778
toxdeps: tox-pypi-filter
@@ -94,7 +95,7 @@ jobs:
9495
needs: [test, docs]
9596
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
9697
with:
97-
python-version: '3.12'
98+
python-version: '3.13'
9899
test_extras: 'tests'
99100
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunkit_spex'
100101
submodules: false

.github/workflows/sub_package_update.yml

Lines changed: 73 additions & 6 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@v4
25+
- uses: actions/checkout@v6
2626

27-
- uses: actions/setup-python@v5
27+
- 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.name,
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
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.12.7"
4+
rev: "v0.14.10"
55
hooks:
66
- id: ruff
77
args: ["--fix"]
88
- id: ruff-format
99
- repo: https://github.com/PyCQA/isort
10-
rev: 6.0.1
10+
rev: 7.0.0
1111
hooks:
1212
- id: isort
1313
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|sunkit_spex/extern)$"
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v5.0.0
15+
rev: v6.0.0
1616
hooks:
1717
- id: check-ast
1818
- id: check-case-conflict

.rtd-environment.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: sunkit-spex
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.10
5+
- python=3.13
66
- pip
77
- graphviz!=2.42.*,!=2.43.*
8-
- sqlite<3.49.0

.ruff.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ select = [
3636
extend-ignore = [
3737
# pycodestyle (E, W)
3838
"E501", # ignore line length will use a formatter instead
39-
# pyupgrade (UP)
40-
"UP038", # Use | in isinstance - not compatible with models and is slower
4139
# pytest (PT)
4240
"PT001", # Always use pytest.fixture()
4341
"PT023", # Always use () on pytest decorators

changelog/234.breaking.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Bump minimum python version to 3.12 and also update some dependencies:
2+
* matplotlib>=3.9
3+
* numdifftools>=0.9.42
4+
* numpy>=1.26
5+
* parfive>=2.1
6+
* scipy>=1.12
7+
* sunpy>=7.0
8+
* xarray>=2023.12
9+
* ndcube>=2.3

pyproject.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ build-backend = "setuptools.build_meta"
99
[project]
1010
name = "sunkit_spex"
1111
description = "A package for solar X-ray spectroscopy."
12-
requires-python = ">=3.10"
12+
requires-python = ">=3.12"
1313
readme = { file = "README.rst", content-type = "text/x-rst" }
14-
license = { file = "licenses/LICENSE.rst" }
14+
license-files = ["licenses/LICENSE.rst"]
1515
authors = [
1616
{ name = "The SunPy Community", email = "[email protected]" },
1717
]
1818
dependencies = [
1919
"corner>=2.2",
2020
"emcee>=3.1",
21-
"matplotlib>=3.7",
21+
"matplotlib>=3.9",
2222
"nestle>=0.2",
23-
"numdifftools>=0.9.40",
24-
"numpy>=1.24",
25-
"parfive>=2.0",
26-
"scipy>=1.11",
27-
"sunpy>=6.0",
28-
"xarray>=2022.10",
23+
"numdifftools>=0.9.42",
24+
"numpy>=1.26", # Note: keeping support for numpy 1.x for now
25+
"parfive>=2.1",
26+
"scipy>=1.12",
27+
"sunpy>=7.0",
28+
"xarray>=2023.12",
2929
"gwcs>=0.21.0",
30-
"ndcube>=2.1",
30+
"ndcube>=2.3",
3131
]
3232

3333
dynamic = ["version"]

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ filterwarnings =
4040
# Oldestdeps issues
4141
ignore:`finfo.machar` is deprecated:DeprecationWarning
4242
ignore:Please use `convolve1d` from the `scipy.ndimage` namespace, the `scipy.ndimage.filters` namespace is deprecated.:DeprecationWarning
43+
ignore::pyparsing.warnings.PyparsingDeprecationWarning
44+
ignore::FutureWarning:arviz.*
45+
ignore:The isiterable function.*:astropy.utils.exceptions.AstropyDeprecationWarning

sunkit_spex/models/physical/tests/test_thermal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def chianti_kev_lines_Fe2():
388388

389389
@pytest.mark.parametrize("ssw", [fvth_simple, fvth_Fe2])
390390
def test_thermal_emission_against_ssw(ssw):
391-
input_args, input_args_class, energy_edges, expected = ssw()
391+
_, input_args_class, energy_edges, expected = ssw()
392392
model_class = thermal.ThermalEmission(*input_args_class)
393393
output_class = model_class(energy_edges)
394394
expected_value = expected.to_value(output_class.unit)
@@ -397,7 +397,7 @@ def test_thermal_emission_against_ssw(ssw):
397397

398398
@pytest.mark.parametrize("ssw", [chianti_kev_cont_simple, chianti_kev_cont_Fe2])
399399
def test_continuum_emission_against_ssw(ssw):
400-
input_args, input_args_class, energy_edges, expected = ssw()
400+
_, input_args_class, energy_edges, expected = ssw()
401401
model_class = thermal.ContinuumEmission(*input_args_class)
402402
output_class = model_class(energy_edges)
403403
expected_value = expected.to_value(output_class.unit)
@@ -406,7 +406,7 @@ def test_continuum_emission_against_ssw(ssw):
406406

407407
@pytest.mark.parametrize("ssw", [chianti_kev_lines_simple, chianti_kev_lines_Fe2])
408408
def test_line_emission_against_ssw(ssw):
409-
input_args, input_args_class, energy_edges, expected = ssw()
409+
_, input_args_class, energy_edges, expected = ssw()
410410
model_class = thermal.LineEmission(*input_args_class)
411411
output_class = model_class(energy_edges)
412412
expected_value = expected.to_value(output_class.unit)
@@ -426,7 +426,7 @@ def test_len1_energy_input():
426426
def test_energy_out_of_range_error():
427427
with pytest.raises(
428428
ValueError,
429-
match="Lower bound of the input energy must be within the range 1.0002920302956426--10.34753795157738 keV. ",
429+
match=r"Lower bound of the input energy must be within the range 1.0002920302956426--10.34753795157738 keV. ",
430430
):
431431
thermal.ThermalEmission(6 * u.MK, 1e-5 / u.cm**3)([0.01, 10] * u.keV)
432432

@@ -448,7 +448,7 @@ def test_line_energy_out_of_range_warning():
448448
def test_continuum_energy_out_of_range():
449449
with pytest.raises(
450450
ValueError,
451-
match="Lower bound of the input energy must be within the range 1.0009873438468269--200.15819869050395 keV.",
451+
match=r"Lower bound of the input energy must be within the range 1.0009873438468269--200.15819869050395 keV.",
452452
):
453453
# Use an energy range that goes out of bounds
454454
# on the lower end--should error

0 commit comments

Comments
 (0)