Skip to content

Commit 88c4c85

Browse files
committed
Merge branch 'main' of github.com:sunpy/sunkit-image into pr/207
2 parents da81f44 + 2ee3205 commit 88c4c85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3572
-1045
lines changed

.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": "67ea3b3815de57668e92dbe1fa2c3d033758d8f0",
3+
"commit": "75f84c4adf1753af67967930c3335bc73bca9bf5",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -16,7 +16,8 @@
1616
"enable_dynamic_dev_versions": "y",
1717
"include_example_code": "n",
1818
"include_cruft_update_github_workflow": "y",
19-
"_sphinx_theme": "alabaster",
19+
"use_extended_ruff_linting": "y",
20+
"_sphinx_theme": "sunpy",
2021
"_parent_project": "",
2122
"_install_requires": "",
2223
"_copy_without_render": [

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
*fits binary
21
*fit binary
3-
*fts binary
42
*fit.gz binary
3+
*fits binary
54
*fits.gz binary
5+
*fts binary
66
*fts.gz binary
7+
*npz binary

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ jobs:
126126
files: ./coverage.xml
127127

128128
publish:
129-
needs: [test, docs]
130129
# Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.*
131130
# see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi
132131
if: |
@@ -135,6 +134,7 @@ jobs:
135134
github.event_name == 'pull_request' &&
136135
contains(github.event.pull_request.labels.*.name, 'Run publish')
137136
)
137+
needs: [test, docs]
138138
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
139139
with:
140140
python-version: '3.12'

.github/workflows/label_sync.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Label Sync
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# ┌───────── minute (0 - 59)
6+
# │ ┌───────── hour (0 - 23)
7+
# │ │ ┌───────── day of the month (1 - 31)
8+
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
9+
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
10+
- cron: '0 0 * * *' # run every day at midnight UTC
11+
12+
# Give permissions to write issue labels
13+
permissions:
14+
issues: write
15+
16+
jobs:
17+
label_sync:
18+
runs-on: ubuntu-latest
19+
name: Label Sync
20+
steps:
21+
- uses: srealmoreno/label-sync-action@850ba5cef2b25e56c6c420c4feed0319294682fd
22+
with:
23+
config-file: https://raw.githubusercontent.com/sunpy/.github/main/labels.yml

.github/workflows/sub_package_update.yml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
fail-fast: true
24-
matrix:
25-
include:
26-
- add-paths: .
27-
body: apply the changes to this repo.
28-
branch: cruft/update
29-
commit-message: "Automatic package template update"
30-
title: Updates from the package template
31-
3224
steps:
3325
- uses: actions/checkout@v4
3426

@@ -55,25 +47,47 @@ jobs:
5547
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
5648
5749
- name: Run update if available
50+
id: cruft_update
5851
if: steps.check.outputs.has_changes == '1'
5952
run: |
6053
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
6154
git config --global user.name "${{ github.actor }}"
6255
63-
cruft update --skip-apply-ask --refresh-private-variables
56+
cruft_output=$(cruft update --skip-apply-ask --refresh-private-variables)
57+
echo $cruft_output
6458
git restore --staged .
6559
66-
- name: Create pull request
60+
if [[ "$cruft_output" == *"Failed to cleanly apply the update, there may be merge conflicts."* ]]; then
61+
echo merge_conflicts=1 >> $GITHUB_OUTPUT
62+
else
63+
echo merge_conflicts=0 >> $GITHUB_OUTPUT
64+
fi
65+
66+
- name: Check if only .cruft.json is modified
67+
id: cruft_json
6768
if: steps.check.outputs.has_changes == '1'
68-
uses: peter-evans/create-pull-request@v6
69+
run: |
70+
git status --porcelain=1
71+
if [[ "$(git status --porcelain=1)" == " M .cruft.json" ]]; then
72+
echo "Only .cruft.json is modified. Exiting workflow early."
73+
echo "has_changes=0" >> "$GITHUB_OUTPUT"
74+
else
75+
echo "has_changes=1" >> "$GITHUB_OUTPUT"
76+
fi
77+
78+
- name: Create pull request
79+
if: steps.cruft_json.outputs.has_changes == '1'
80+
uses: peter-evans/create-pull-request@v7
6981
with:
7082
token: ${{ secrets.GITHUB_TOKEN }}
71-
add-paths: ${{ matrix.add-paths }}
72-
commit-message: ${{ matrix.commit-message }}
73-
branch: ${{ matrix.branch }}
83+
add-paths: "."
84+
commit-message: "Automatic package template update"
85+
branch: "cruft/update"
7486
delete-branch: true
75-
branch-suffix: timestamp
76-
title: ${{ matrix.title }}
87+
draft: ${{ steps.cruft_update.outputs.merge_conflicts == '1' }}
88+
title: "Updates from the package template"
7789
body: |
78-
This is an autogenerated PR, which will ${{ matrix.body }}.
79-
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
90+
This is an autogenerated PR, which will applies the latest changes from the [SunPy Package Template](https://github.com/sunpy/package-template).
91+
If this pull request has been opened as a draft there are conflicts which need fixing.
92+
93+
**To run the CI on this pull request you will need to close it and reopen it.**

.pre-commit-config.yaml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
repos:
2-
- repo: https://github.com/PyCQA/docformatter
3-
rev: master
4-
hooks:
5-
- id: docformatter
6-
args: ["--in-place", "--pre-summary-newline", "--make-summary-multi"]
7-
- repo: https://github.com/PyCQA/autoflake
8-
rev: v2.3.1
9-
hooks:
10-
- id: autoflake
11-
args:
12-
[
13-
"--in-place",
14-
"--remove-all-unused-imports",
15-
"--remove-unused-variable",
16-
]
17-
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$"
182
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: "v0.6.3"
3+
rev: "v0.7.3"
204
hooks:
215
- id: ruff
226
args: ["--fix"]
@@ -26,16 +10,12 @@ repos:
2610
- id: isort
2711
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|sunkit_image/extern)$"
2812
- repo: https://github.com/pre-commit/pre-commit-hooks
29-
rev: v4.6.0
13+
rev: v5.0.0
3014
hooks:
3115
- id: check-ast
3216
- id: check-case-conflict
3317
- id: trailing-whitespace
34-
exclude: ".*(.fits|.fts|.fit|.txt|.header|.csv)$"
35-
- id: mixed-line-ending
36-
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
37-
- id: end-of-file-fixer
38-
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
18+
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
3919
- id: check-yaml
4020
- id: debug-statements
4121
- id: check-added-large-files
@@ -45,12 +25,17 @@ repos:
4525
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
4626
- id: mixed-line-ending
4727
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
28+
- repo: https://github.com/codespell-project/codespell
29+
rev: v2.3.0
30+
hooks:
31+
- id: codespell
32+
args: [ "--write-changes" ]
4833
- repo: https://github.com/crate-ci/typos
49-
rev: v1.23.1
34+
rev: typos-dict-v0.11.35
5035
hooks:
5136
- id: typos
5237
- repo: https://github.com/pre-commit/mirrors-mypy
53-
rev: "v1.10.1"
38+
rev: "v1.13.0"
5439
hooks:
5540
- id: mypy
5641
additional_dependencies: ["types-setuptools"]

.ruff.toml

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
target-version = "py310"
2-
line-length = 110
2+
line-length = 120
33
exclude = [
44
".git,",
55
"__pycache__",
@@ -8,30 +8,75 @@ exclude = [
88
]
99

1010
[lint]
11-
select = ["E", "F", "W", "UP", "PT"]
11+
select = [
12+
"E",
13+
"F",
14+
"W",
15+
"UP",
16+
"PT",
17+
"BLE",
18+
"A",
19+
"C4",
20+
"INP",
21+
"PIE",
22+
"T20",
23+
"RET",
24+
"TID",
25+
"PTH",
26+
"PD",
27+
"PLC",
28+
"PLE",
29+
"FLY",
30+
"NPY",
31+
"PERF",
32+
"RUF",
33+
]
1234
extend-ignore = [
1335
# pycodestyle (E, W)
14-
"E501", # LineTooLong # TODO! fix
36+
"E501", # ignore line length will use a formatter instead
37+
# pyupgrade (UP)
38+
"UP038", # Use | in isinstance - not compatible with models and is slower
1539
# pytest (PT)
1640
"PT001", # Always use pytest.fixture()
1741
"PT004", # Fixtures which don't return anything should have leading _
18-
"PT007", # Parametrize should be lists of tuples # TODO! fix
19-
"PT011", # Too broad exception assert # TODO! fix
2042
"PT023", # Always use () on pytest decorators
43+
# flake8-pie (PIE)
44+
"PIE808", # Disallow passing 0 as the first argument to range
45+
# flake8-use-pathlib (PTH)
46+
"PTH123", # open() should be replaced by Path.open()
47+
# Ruff (RUF)
48+
"RUF003", # Ignore ambiguous quote marks, doesn't allow ' in comments
49+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
50+
"RUF013", # PEP 484 prohibits implicit `Optional`
51+
"RUF015", # Prefer `next(iter(...))` over single element slice
2152
]
2253

2354
[lint.per-file-ignores]
24-
# Part of configuration, not a package.
25-
"setup.py" = ["INP001"]
26-
"conftest.py" = ["INP001"]
55+
"setup.py" = [
56+
"INP001", # File is part of an implicit namespace package.
57+
]
58+
"conftest.py" = [
59+
"INP001", # File is part of an implicit namespace package.
60+
]
2761
"docs/conf.py" = [
28-
"E402" # Module imports not at top of file
62+
"E402" # Module imports not at top of file
2963
]
3064
"docs/*.py" = [
31-
"INP001", # Implicit-namespace-package. The examples are not a package.
65+
"INP001", # File is part of an implicit namespace package.
66+
]
67+
"examples/**.py" = [
68+
"T201", # allow use of print in examples
69+
"INP001", # File is part of an implicit namespace package.
70+
]
71+
"__init__.py" = [
72+
"E402", # Module level import not at top of cell
73+
"F401", # Unused import
74+
"F403", # from {name} import * used; unable to detect undefined names
75+
"F405", # {name} may be undefined, or defined from star imports
76+
]
77+
"test_*.py" = [
78+
"E402", # Module level import not at top of cell
3279
]
33-
"__init__.py" = ["E402", "F401", "F403"]
34-
"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"]
3580

3681
[lint.pydocstyle]
3782
convention = "numpy"

changelog/205.doc.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Added a new example for `sunkit_image.radial.rhef` at :ref:`sphx_glr_generated_gallery_radial_histogram_equalization.py`
2-
Added RFEF to :ref:`sphx_glr_generated_gallery_radial_gradient_filters.py` as a comparison to the other filters.
2+
3+
Added RHEF to :ref:`sphx_glr_generated_gallery_radial_gradient_filters.py` as a comparison to the other filters.

changelog/215.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Within `sunkit_image.enhance.mgn`, the input data is now cast to float32 to work around int/float being cast to each other causing an error.

changelog/215.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added unit tests with a JSOC cutout file.

0 commit comments

Comments
 (0)