Skip to content

Commit c896d50

Browse files
committed
Updates in line with package template
1 parent 11334f2 commit c896d50

File tree

14 files changed

+198
-119
lines changed

14 files changed

+198
-119
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": "1eff2ed0ff32c123e64b5faacf7c505362cfbb92",
3+
"commit": "4ca8e60aac805d5f736de80c45ae0aba96b4cb85",
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": "n",
20+
"_sphinx_theme": "sunpy",
2021
"_parent_project": "",
2122
"_install_requires": "",
2223
"_copy_without_render": [

.github/workflows/ci.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- '!*pre*'
1313
- '!*post*'
1414
pull_request:
15-
# Allow manual runs through the web UI
15+
# Allow manual runs through the web UI
1616
workflow_dispatch:
1717

1818
concurrency:
@@ -90,6 +90,27 @@ jobs:
9090
submodules: false
9191
coverage: codecov
9292
toxdeps: tox-pypi-filter
93+
secrets:
94+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
95+
96+
publish:
97+
# Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.*
98+
# see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi
99+
if: |
100+
github.event_name != 'pull_request' ||
101+
(
102+
github.event_name == 'pull_request' &&
103+
contains(github.event.pull_request.labels.*.name, 'Run publish')
104+
)
105+
needs: [test, docs]
106+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
107+
with:
108+
python-version: '3.12'
109+
test_extras: 'tests'
110+
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunpy_soar'
111+
submodules: false
112+
secrets:
113+
pypi_token: ${{ secrets.pypi_token }}
93114
envs: |
94115
- linux: py312-devdeps
95116
secrets:

.github/workflows/sub_package_update.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +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-
- add-paths: .cruft.json
32-
body: reject these changes for this repo.
33-
branch: cruft/reject
34-
commit-message: "Reject this package template update"
35-
title: Reject new updates from package template
36-
3724
steps:
3825
- uses: actions/checkout@v4
3926

@@ -42,7 +29,7 @@ jobs:
4229
python-version: "3.11"
4330

4431
- name: Install Cruft
45-
run: python -m pip install cruft
32+
run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1
4633

4734
- name: Check if update is available
4835
continue-on-error: false
@@ -60,25 +47,47 @@ jobs:
6047
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
6148
6249
- name: Run update if available
50+
id: cruft_update
6351
if: steps.check.outputs.has_changes == '1'
6452
run: |
6553
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
6654
git config --global user.name "${{ github.actor }}"
6755
68-
cruft update --skip-apply-ask --refresh-private-variables
56+
cruft_output=$(cruft update --skip-apply-ask --refresh-private-variables)
57+
echo $cruft_output
6958
git restore --staged .
7059
71-
- 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
7268
if: steps.check.outputs.has_changes == '1'
73-
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
7481
with:
7582
token: ${{ secrets.GITHUB_TOKEN }}
76-
add-paths: ${{ matrix.add-paths }}
77-
commit-message: ${{ matrix.commit-message }}
78-
branch: ${{ matrix.branch }}
83+
add-paths: "."
84+
commit-message: "Automatic package template update"
85+
branch: "cruft/update"
7986
delete-branch: true
80-
branch-suffix: timestamp
81-
title: ${{ matrix.title }}
87+
draft: ${{ steps.cruft_update.outputs.merge_conflicts == '1' }}
88+
title: "Updates from the package template"
8289
body: |
83-
This is an autogenerated PR, which will ${{ matrix.body }}.
84-
[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.**

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ instance/
7676
docs/_build/
7777
# automodapi
7878
docs/api
79+
docs/sg_execution_times.rst
7980

8081
# PyBuilder
8182
.pybuilder/

.pre-commit-config.yaml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
1-
exclude: ".*(.fits|.fts|.fit|.txt|.csv)$"
21
repos:
3-
- repo: https://github.com/PyCQA/docformatter
4-
rev: v1.7.5
5-
hooks:
6-
- id: docformatter
7-
args: [--in-place, --pre-summary-newline, --make-summary-multi]
8-
- repo: https://github.com/PyCQA/autoflake
9-
rev: v2.3.1
10-
hooks:
11-
- id: autoflake
12-
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
13-
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$"
2+
# This should be before any formatting hooks like isort
143
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: 'v0.4.4'
4+
rev: "v0.7.0"
165
hooks:
176
- id: ruff
18-
args: ["--fix", "--unsafe-fixes"]
19-
- id: ruff-format
20-
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v4.6.0
22-
hooks:
7+
args: ["--fix"]
8+
- repo: https://github.com/PyCQA/isort
9+
rev: 5.13.2
10+
hooks:
11+
- id: isort
12+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|{{ cookiecutter.module_name }}/extern)$"
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v5.0.0
15+
hooks:
2316
- id: check-ast
2417
- id: check-case-conflict
2518
- id: trailing-whitespace
26-
- id: mixed-line-ending
27-
- id: end-of-file-fixer
19+
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
2820
- id: check-yaml
2921
- id: debug-statements
22+
- id: check-added-large-files
23+
args: ["--enforce-all", "--maxkb=1054"]
24+
- id: end-of-file-fixer
25+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
26+
- id: mixed-line-ending
27+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
3028
- repo: https://github.com/codespell-project/codespell
31-
rev: v2.2.6
29+
rev: v2.3.0
3230
hooks:
3331
- id: codespell
34-
additional_dependencies:
35-
- tomli
32+
args: [ "--write-changes" ]
3633
ci:
3734
autofix_prs: false
38-
autoupdate_schedule: "quarterly"
35+
autoupdate_schedule: "quarterly"

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2
22

33
build:
4-
os: ubuntu-22.04
4+
os: ubuntu-lts-latest
55
tools:
6-
python: "mambaforge-4.10"
6+
python: "mambaforge-latest"
77
jobs:
88
post_checkout:
99
- git fetch --unshallow || true

.rtd-environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rtd_soar
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.11
5+
- python=3.12
66
- pip
77
- graphviz!=2.42.*,!=2.43.*

.ruff.toml

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,33 @@ exclude=[
88
"build",
99
"tools/**",
1010
]
11-
lint.select = [
12-
"A",
13-
"ARG",
14-
"ASYNC",
15-
"B",
16-
"BLE",
17-
"C4",
18-
# "C90",
19-
"COM",
20-
# "D",
21-
"DTZ",
22-
"E",
23-
"EM",
24-
"ERA",
25-
"EXE",
26-
"F",
27-
"FBT",
28-
"FLY",
29-
# "FURB",
30-
"G",
31-
"I",
32-
"ICN",
33-
"INP",
34-
"INT",
35-
"ISC",
36-
"LOG",
37-
# "N",
38-
"NPY",
39-
"PERF",
40-
"PGH",
41-
"PIE",
42-
# "PL",
43-
"PLE",
44-
"PT",
45-
"PTH",
46-
"PYI",
47-
"Q",
48-
"RET",
49-
"RSE",
50-
"RUF",
51-
# "S",
52-
"SIM",
53-
"SLF",
54-
"SLOT",
55-
"T10",
56-
"T20",
57-
"TCH",
58-
"TID",
59-
"TRIO",
60-
"TRY",
61-
"UP",
62-
"W",
63-
"YTT",
11+
12+
[lint]
13+
select = [
14+
"E",
15+
"F",
16+
"W",
17+
"UP",
18+
"PT",
6419
]
65-
lint.extend-ignore = [
66-
"COM812", # May cause conflicts when used with the formatter
67-
"ISC001", # May cause conflicts when used with the formatter
20+
extend-ignore = [
21+
# pycodestyle (E, W)
22+
"E501", # ignore line length will use a formatter instead
23+
# pyupgrade (UP)
24+
"UP038", # Use | in isinstance - not compatible with models and is slower
25+
# pytest (PT)
26+
"PT001", # Always use pytest.fixture()
27+
"PT004", # Fixtures which don't return anything should have leading _
28+
"PT023", # Always use () on pytest decorators
29+
# flake8-pie (PIE)
30+
"PIE808", # Disallow passing 0 as the first argument to range
31+
# flake8-use-pathlib (PTH)
32+
"PTH123", # open() should be replaced by Path.open()
33+
# Ruff (RUF)
34+
"RUF003", # Ignore ambiguous quote marks, doesn't allow ' in comments
35+
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
36+
"RUF013", # PEP 484 prohibits implicit `Optional`
37+
"RUF015", # Prefer `next(iter(...))` over single element slice
6838
]
6939

7040
[lint.per-file-ignores]
@@ -74,9 +44,34 @@ lint.extend-ignore = [
7444
"B018", # Not print but display
7545
"ERA001", # Commented out code
7646
]
47+
"setup.py" = [
48+
"INP001", # File is part of an implicit namespace package.
49+
]
50+
"conftest.py" = [
51+
"INP001", # File is part of an implicit namespace package.
52+
]
53+
"docs/conf.py" = [
54+
"E402" # Module imports not at top of file
55+
]
7756
"docs/conf.py" = [
7857
"INP001", # conf.py is part of an implicit namespace package
7958
]
59+
"docs/*.py" = [
60+
"INP001", # File is part of an implicit namespace package.
61+
]
62+
"examples/**.py" = [
63+
"T201", # allow use of print in examples
64+
"INP001", # File is part of an implicit namespace package.
65+
]
66+
"__init__.py" = [
67+
"E402", # Module level import not at top of cell
68+
"F401", # Unused import
69+
"F403", # from {name} import * used; unable to detect undefined names
70+
"F405", # {name} may be undefined, or defined from star imports
71+
]
72+
"test_*.py" = [
73+
"E402", # Module level import not at top of cell
74+
]
8075

8176
[lint.pydocstyle]
8277
convention = "numpy"

0 commit comments

Comments
 (0)