Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register template #672

Merged
merged 34 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d8c9805
Adds SunPy packaging template
CyclingNinja Feb 15, 2024
b23d2b8
Clean out duplicated files
CyclingNinja Feb 15, 2024
b3b0e1f
Merge branch 'main' of github.com:sunpy/ndcube
CyclingNinja Feb 15, 2024
3379464
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 15, 2024
cb35532
Merge branch 'main' of github.com:CyclingNinja/ndcube
CyclingNinja Feb 15, 2024
d1db721
Merge branch 'main' of github.com:sunpy/ndcube
CyclingNinja Apr 15, 2024
6ee0b2d
Registers NdCube with the SunPy template
CyclingNinja Apr 15, 2024
89df6f8
Upgrades minium dep version of numpy
CyclingNinja Apr 15, 2024
7405405
Remove sunpy-core specific ruff config
CyclingNinja Apr 16, 2024
a94d77a
Corrects ci indentation error
CyclingNinja Apr 16, 2024
2d08fef
Removes duplications in pyproject.toml
CyclingNinja Apr 16, 2024
2a73c4f
Adds dependancies and correct ci
CyclingNinja Apr 17, 2024
1a8cf8a
Update pyproject.toml
CyclingNinja Apr 17, 2024
bb5139a
Recitfy pytest.ini
CyclingNinja Apr 18, 2024
c53e27e
Recitfy pytest.ini
CyclingNinja Apr 18, 2024
d5d79c9
Deps additions
CyclingNinja Apr 18, 2024
1fdfcb3
Merge branch 'register_template' of github.com:CyclingNinja/ndcube in…
CyclingNinja Apr 18, 2024
7e4d5a6
Removing unneeded module
CyclingNinja Apr 18, 2024
bb7200c
Rectifies docs/tests issues:
CyclingNinja Apr 18, 2024
e236174
Standardises pre-commit-config
CyclingNinja Apr 18, 2024
4eb6781
Update pyproject.toml
CyclingNinja Apr 18, 2024
116ff30
Update .ruff.toml
CyclingNinja Apr 18, 2024
bb10557
reverse sphinx pin
CyclingNinja Apr 18, 2024
83b9d13
Update .codespellrc
CyclingNinja Apr 18, 2024
509dca5
Update .ruff.toml
CyclingNinja Apr 18, 2024
5a76e5e
Update pyproject.toml
CyclingNinja Apr 18, 2024
03461a0
Merge branch 'register_template' of github.com:CyclingNinja/ndcube in…
CyclingNinja Apr 18, 2024
b726cda
Update tox.ini
CyclingNinja Apr 18, 2024
98526e5
Update tox.ini
CyclingNinja Apr 18, 2024
0bf3a86
Ignore .bib in codespell rc
CyclingNinja Apr 19, 2024
6b94f47
Merge branch 'register_template' of github.com:CyclingNinja/ndcube in…
CyclingNinja Apr 19, 2024
2ed8b11
Apply isort to imports
CyclingNinja Apr 19, 2024
55c4272
Merge branch 'main' into register_template
Cadair Apr 22, 2024
d1d02e7
update template
Cadair Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ coverage:
project:
default:
threshold: 0.2%

codecov:
require_ci_to_pass: false
notify:
wait_for_ci: true
14 changes: 14 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[codespell]
skip = *.asdf,*.fits,*.fts,*.header,*.json,*.xsh,*cache*,*egg*,*extern*,.git,.idea,.tox,_build,*truncated,*.svg,.asv_env,.history,*.bib
ignore-words-list =
alog,
CyclingNinja marked this conversation as resolved.
Show resolved Hide resolved
aas,
nd,
nin,
observ,
ot,
te,
upto,
afile,
precessed,
precess
30 changes: 30 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[run]
omit =
ndcube/conftest.py
ndcube/*setup_package*
ndcube/extern/*
ndcube/version*
*/ndcube/conftest.py
*/ndcube/*setup_package*
*/ndcube/extern/*
*/ndcube/version*

[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about packages we have installed
except ImportError
# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError
# Don't complain about script hooks
def main(.*):
# Ignore branches that don't pertain to this version of Python
pragma: py{ignore_python_version}
# Don't complain about IPython completion helper
def _ipython_key_completions_
# typing.TYPE_CHECKING is False at runtime
if TYPE_CHECKING:
# Ignore typing overloads
@overload
31 changes: 31 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "6d6729b22066ef890e70c37438da70cac33e03b4",
"checkout": null,
"context": {
"cookiecutter": {
"package_name": "ndcube",
"module_name": "ndcube",
"short_description": "A package for multi-dimensional contiguous and non-contiguous coordinate aware arrays.",
"author_name": "The SunPy Community",
"author_email": "[email protected]",
"project_url": "https://docs.sunpy.org/projects/ndcube",
"license": "BSD 2-Clause",
"minimum_python_version": "3.9",
"use_compiled_extensions": "n",
"enable_dynamic_dev_versions": "y",
"include_example_code": "n",
"include_cruft_update_github_workflow": "y",
"_sphinx_theme": "alabaster",
"_parent_project": "",
"_install_requires": "",
"_copy_without_render": [
"docs/_templates",
"docs/_static",
".github/workflows/sub_package_update.yml"
],
"_template": "https://github.com/sunpy/package-template"
}
},
"directory": null
}
27 changes: 27 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[flake8]
ignore =
# missing-whitespace-around-operator
E225
# missing-whitespace-around-arithmetic-operator
E226
# line-too-long
E501
# unused-import
F401
# undefined-local-with-import-star
F403
# redefined-while-unused
F811
# Line break occurred before a binary operator
W503,
# Line break occurred after a binary operator
W504
max-line-length = 110
exclude =
.git
__pycache__
docs/conf.py
build
ndcube/__init__.py
rst-directives =
plot
83 changes: 54 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,61 @@ on:
# Allow manual runs through the web UI
workflow_dispatch:

# Automatically cancel old builds
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
core:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
envs: |
- linux: py311
- linux: py312
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

sdist_verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install -U --user build
- run: python -m build . --sdist
- run: python -m pip install -U --user twine
- run: python -m twine check dist/*

test:
needs: [core]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
needs: [core, sdist_verify]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n auto
envs: |
- windows: py311
- macos: py310
- windows: py39
- linux: py39-oldestdeps
- linux: py310-oldestdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
needs: [core]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.10'
submodules: false
pytest: false
toxdeps: tox-pypi-filter
libraries: |
apt:
- graphviz
envs: |
- linux: build_docs
posargs: ''
pytest: false
Expand All @@ -56,37 +84,34 @@ jobs:
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Run cron CI')
)
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
default_python: '3.10'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
envs: |
- linux: py311-devdeps
- linux: py39-conda
libraries: ''

publish:
# Build wheels when pushing to any branch except main
# publish.yml will only publish if tagged ^v.*
if: |
github.event_name != 'pull_request' && (
github.ref_name != 'main' ||
github.event_name == 'workflow_dispatch' )
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
with:
python-version: '3.9'
test_extras: 'dev'
test_command: 'pytest -p no:warnings --doctest-rst -m "not mpl_image_compare" --pyargs ndcube'
submodules: false
secrets:
pypi_token: ${{ secrets.pypi_token }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish_pure:
if: |
github.event_name != 'pull_request' && (
github.ref_name != 'main' ||
github.event_name == 'workflow_dispatch' )
needs: [test, docs]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
with:
python-version: '3.10'
test_extras: 'tests'
test_command: 'pytest -p no:warnings --doctest-rst --pyargs ndcube'
submodules: false
secrets:
pypi_token: ${{ secrets.pypi_token }}
notify:
if: always() && github.event_name == 'workflow_dispatch'
needs: [publish, cron]
needs: [publish_pure, cron]
runs-on: ubuntu-latest
steps:
- uses: Cadair/matrix-notify-action@main
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/sub_package_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This template is taken from the cruft example code, for further information please see:
# https://cruft.github.io/cruft/#automating-updates-with-github-actions
name: Automatic Update from package template
permissions:
contents: write
pull-requests: write

on:
# Allow manual runs through the web UI
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 7 * * 1' # Every Monday at 7am UTC

jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- add-paths: .
body: apply the changes to this repo.
branch: cruft/update
commit-message: "Automatic package template update"
title: Updates from the package template
- add-paths: .cruft.json
body: reject these changes for this repo.
branch: cruft/reject
commit-message: "Reject this package template update"
title: Reject new updates from package template

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Cruft
run: python -m pip install cruft

- name: Check if update is available
continue-on-error: false
id: check
run: |
CHANGES=0
if [ -f .cruft.json ]; then
if ! cruft check; then
CHANGES=1
fi
else
echo "No .cruft.json file"
fi

echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"

- name: Run update if available
if: steps.check.outputs.has_changes == '1'
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"

cruft update --skip-apply-ask --refresh-private-variables
git restore --staged .

- name: Create pull request
if: steps.check.outputs.has_changes == '1'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: ${{ matrix.add-paths }}
commit-message: ${{ matrix.commit-message }}
branch: ${{ matrix.branch }}
delete-branch: true
branch-suffix: timestamp
title: ${{ matrix.title }}
body: |
This is an autogenerated PR, which will ${{ matrix.body }}.
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
Loading
Loading