Skip to content

Commit 6841a1b

Browse files
Register template (#116)
* Registers package with the SunPy template * Refines pyproject.toml * Update .coveragerc Co-authored-by: Nabil Freij <[email protected]> * Update .cruft.json Co-authored-by: Nabil Freij <[email protected]> * Update .github/workflows/ci.yml Co-authored-by: Nabil Freij <[email protected]> * Update .ruff.toml Co-authored-by: Nabil Freij <[email protected]> * Update pyproject.toml Co-authored-by: Nabil Freij <[email protected]> * Update .isort.cfg Co-authored-by: Nabil Freij <[email protected]> * Update pytest.ini Co-authored-by: Nabil Freij <[email protected]> * Update .pre-commit-config.yaml Co-authored-by: Nabil Freij <[email protected]> * Removes importlib-resources * Update python minimum version * Update template --------- Co-authored-by: Nabil Freij <[email protected]>
1 parent 65b7ce7 commit 6841a1b

31 files changed

+908
-348
lines changed

.codecov.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
comment: off
2+
coverage:
3+
status:
4+
project:
5+
default:
6+
threshold: 0.2%
7+
8+
codecov:
9+
require_ci_to_pass: false
10+
notify:
11+
wait_for_ci: true

.codespellrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[codespell]
2+
skip = *.asdf,*.fits,*.fts,*.header,*.json,*.xsh,*cache*,*egg*,*extern*,.git,.idea,.tox,_build,*truncated,*.svg,.asv_env,.history
3+
ignore-words-list =
4+
alog,
5+
nd,
6+
nin,
7+
observ,
8+
ot,
9+
te,
10+
upto,
11+
afile,
12+
precessed,
13+
precess,
14+
soop

.coveragerc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[run]
2+
omit =
3+
sunpy_soar/conftest.py
4+
sunpy_soar/*setup_package*
5+
sunpy_soar/extern/*
6+
sunpy_soar/version*
7+
*/sunpy_soar/conftest.py
8+
*/sunpy_soar/*setup_package*
9+
*/sunpy_soar/extern/*
10+
*/sunpy_soar/version*
11+
12+
[report]
13+
exclude_lines =
14+
# Have to re-enable the standard pragma
15+
pragma: no cover
16+
# Don't complain about packages we have installed
17+
except ImportError
18+
# Don't complain if tests don't hit assertions
19+
raise AssertionError
20+
raise NotImplementedError
21+
# Don't complain about script hooks
22+
def main(.*):
23+
# Ignore branches that don't pertain to this version of Python
24+
pragma: py{ignore_python_version}
25+
# Don't complain about IPython completion helper
26+
def _ipython_key_completions_
27+
# typing.TYPE_CHECKING is False at runtime
28+
if TYPE_CHECKING:
29+
# Ignore typing overloads
30+
@overload

.cruft.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"template": "https://github.com/sunpy/package-template",
3+
"commit": "1eff2ed0ff32c123e64b5faacf7c505362cfbb92",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"package_name": "sunpy-soar",
8+
"module_name": "sunpy_soar",
9+
"short_description": "A sunpy FIDO plugin for accessing data in the Solar Orbiter Archive (SOAR).",
10+
"author_name": "The SunPy Community",
11+
"author_email": "[email protected]",
12+
"project_url": "https://sunpy.org",
13+
"license": "BSD 2-Clause",
14+
"minimum_python_version": "3.10",
15+
"use_compiled_extensions": "n",
16+
"enable_dynamic_dev_versions": "y",
17+
"include_example_code": "n",
18+
"include_cruft_update_github_workflow": "y",
19+
"_sphinx_theme": "alabaster",
20+
"_parent_project": "",
21+
"_install_requires": "",
22+
"_copy_without_render": [
23+
"docs/_templates",
24+
"docs/_static",
25+
".github/workflows/sub_package_update.yml"
26+
],
27+
"_template": "https://github.com/sunpy/package-template"
28+
}
29+
},
30+
"directory": null
31+
}

.flake8

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[flake8]
2+
ignore =
3+
# missing-whitespace-around-operator
4+
E225
5+
# missing-whitespace-around-arithmetic-operator
6+
E226
7+
# line-too-long
8+
E501
9+
# unused-import
10+
F401
11+
# undefined-local-with-import-star
12+
F403
13+
# redefined-while-unused
14+
F811
15+
# Line break occurred before a binary operator
16+
W503,
17+
# Line break occurred after a binary operator
18+
W504
19+
max-line-length = 110
20+
exclude =
21+
.git
22+
__pycache__
23+
docs/conf.py
24+
build
25+
sunpy_soar/__init__.py
26+
rst-directives =
27+
plot

.github/workflows/ci.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,42 @@ jobs:
2828
toxdeps: tox-pypi-filter
2929
posargs: -n auto
3030
envs: |
31-
- linux: py311
31+
- linux: py312
3232
secrets:
3333
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3434

35+
sdist_verify:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.12'
42+
- run: python -m pip install -U --user build
43+
- run: python -m build . --sdist
44+
- run: python -m pip install -U --user twine
45+
- run: python -m twine check dist/*
46+
3547
test:
36-
needs: [core]
48+
needs: [core, sdist_verify]
3749
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
3850
with:
3951
submodules: false
4052
coverage: codecov
4153
toxdeps: tox-pypi-filter
4254
posargs: -n auto
4355
envs: |
44-
- windows: py310
45-
- macos: py39
46-
- linux: py311-devdeps
56+
- windows: py311
57+
- macos: py310
58+
- linux: py310-oldestdeps
4759
secrets:
4860
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4961

5062
docs:
5163
needs: [core]
5264
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
5365
with:
54-
default_python: '3.9'
66+
default_python: '3.12'
5567
submodules: false
5668
pytest: false
5769
toxdeps: tox-pypi-filter
@@ -66,13 +78,30 @@ jobs:
6678
envs: |
6779
- linux: build_docs
6880
69-
publish:
70-
needs: [test]
71-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
81+
cron:
82+
if: |
83+
github.event_name == 'workflow_dispatch' || (
84+
github.event_name == 'pull_request' &&
85+
contains(github.event.pull_request.labels.*.name, 'Run cron CI')
86+
)
87+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
7288
with:
73-
python-version: '3.9'
74-
test_extras: 'tests'
75-
test_command: 'pytest -p no:warnings --pyargs sunpy_soar'
89+
default_python: '3.12'
7690
submodules: false
91+
coverage: codecov
92+
toxdeps: tox-pypi-filter
93+
envs: |
94+
- linux: py312-devdeps
7795
secrets:
78-
pypi_token: ${{ secrets.pypi_token }}
96+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
97+
98+
publish_pure:
99+
needs: [test, docs]
100+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@main
101+
with:
102+
python-version: '3.12'
103+
test_extras: 'tests'
104+
test_command: 'pytest -p no:warnings --doctest-rst --pyargs sunpy_soar'
105+
submodules: false
106+
secrets:
107+
pypi_token: ${{ secrets.pypi_token }}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This template is taken from the cruft example code, for further information please see:
2+
# https://cruft.github.io/cruft/#automating-updates-with-github-actions
3+
name: Automatic Update from package template
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
on:
9+
# Allow manual runs through the web UI
10+
workflow_dispatch:
11+
schedule:
12+
# ┌───────── minute (0 - 59)
13+
# │ ┌───────── hour (0 - 23)
14+
# │ │ ┌───────── day of the month (1 - 31)
15+
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
16+
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
17+
- cron: '0 7 * * 1' # Every Monday at 7am UTC
18+
19+
jobs:
20+
update:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
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+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.11"
43+
44+
- name: Install Cruft
45+
run: python -m pip install cruft
46+
47+
- name: Check if update is available
48+
continue-on-error: false
49+
id: check
50+
run: |
51+
CHANGES=0
52+
if [ -f .cruft.json ]; then
53+
if ! cruft check; then
54+
CHANGES=1
55+
fi
56+
else
57+
echo "No .cruft.json file"
58+
fi
59+
60+
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
61+
62+
- name: Run update if available
63+
if: steps.check.outputs.has_changes == '1'
64+
run: |
65+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
66+
git config --global user.name "${{ github.actor }}"
67+
68+
cruft update --skip-apply-ask --refresh-private-variables
69+
git restore --staged .
70+
71+
- name: Create pull request
72+
if: steps.check.outputs.has_changes == '1'
73+
uses: peter-evans/create-pull-request@v6
74+
with:
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
add-paths: ${{ matrix.add-paths }}
77+
commit-message: ${{ matrix.commit-message }}
78+
branch: ${{ matrix.branch }}
79+
delete-branch: true
80+
branch-suffix: timestamp
81+
title: ${{ matrix.title }}
82+
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

0 commit comments

Comments
 (0)