Skip to content

Commit

Permalink
Updates Sunpy core with package template (#7494)
Browse files Browse the repository at this point in the history
* Updates Sunpy core with package template

* Removes suprious sdist_verify

* Cleans pyproject.toml

* Corrects CI workflow

* Final clean up config files

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removes oldest deps from tox.ini

* Correct copy paste error

* Make sure all deps have mins

* Some tox tweaks

* Update tox.ini

* Drop 3.9 from the cibuildwheel targets

* Bump numpy in line with SPEC 0 due to py3.10 compat

* Revert minimum deps to oldestdeps

* Update tox.ini

Co-authored-by: Stuart Mumford <stuart@cadair.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Stuart Mumford <stuart@cadair.com>
  • Loading branch information
3 people committed Apr 9, 2024
1 parent 9f0a37d commit 9c4ff1a
Show file tree
Hide file tree
Showing 16 changed files with 286 additions and 86 deletions.
31 changes: 24 additions & 7 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
[run]
omit =
sunpy/cython_version*
sunpy/conftest.py
sunpy/*setup_package*
sunpy/extern/*
sunpy/version*
sunpy/data/sample.py
sunpy/data/_sample.py
sunpy/data/test/_generate_asdf_test.py
*/sunpy/cython_version*
*/sunpy/conftest.py
*/sunpy/*setup_package*
*/sunpy/extern/*
*/sunpy/version*
*/sunpy/data/sample.py
*/sunpy/data/_sample.py

[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": "d91a5d5e80dfa4402924cc0abfe104db30e239f9",
"checkout": null,
"context": {
"cookiecutter": {
"package_name": "sunpy",
"module_name": "sunpy",
"short_description": "SunPy core package: Python for Solar Physics",
"author_name": "The SunPy Community",
"author_email": "sunpy@googlegroups.com",
"project_url": "https://sunpy.org",
"license": "BSD 2-Clause",
"minimum_python_version": "3.9",
"use_compiled_extensions": "y",
"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
}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Run publish')
)
needs: [test]
needs: [test, docs]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@main
with:
upload_to_anaconda: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
Expand All @@ -185,9 +185,9 @@ jobs:
test_command: 'pytest -p no:warnings --doctest-rst -m "not mpl_image_compare" --pyargs sunpy'
submodules: false
targets: |
- cp3{9,10,11,12}-manylinux*_x86_64
- cp3{9,10,11,12}-macosx_x86_64
- cp3{9,10,11,12}-macosx_arm64
- cp3{10,11,12}-manylinux*_x86_64
- cp3{10,11,12}-macosx_x86_64
- cp3{10,11,12}-macosx_arm64
secrets:
pypi_token: ${{ secrets.pypi_token }}
anaconda_token: ${{ secrets.anaconda_org_upload_token }}
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
87 changes: 64 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
sunpy/_version.py
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
Expand All @@ -36,15 +43,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
junit/
cover/

# Translations
*.mo
Expand All @@ -54,6 +63,7 @@ junit/
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -66,18 +76,46 @@ instance/
docs/_build/
# sphinx gallery execution times
docs/sg_execution_times.rst
# automodapi
docs/api

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version
# IPython
profile_default/
ipython_config.py

# celery beat schedule file
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py
Expand All @@ -91,13 +129,6 @@ ENV/
env.bak/
venv.bak/

# Pipenv
Pipfile

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

Expand All @@ -107,16 +138,29 @@ Pipfile
# mypy
.mypy_cache/

### https://raw.github.com/github/gitignore/master/Global/OSX.gitignore
# Pyre type checker
.pyre/

# IDE
# PyCharm
.idea

# Spyder project settings
.spyderproject
.spyproject

### VScode: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore
.vscode/*
.vs/*

### https://raw.github.com/github/gitignore/master/Global/OSX.gitignore
.DS_Store
.AppleDouble
.LSOverride

# Icon must ends with two \r.
Icon


# Thumbnails
._*

Expand All @@ -125,7 +169,6 @@ Icon
.Trashes

### Linux: https://raw.githubusercontent.com/github/gitignore/master/Global/Linux.gitignore

*~

# temporary files which can be created if a process still has a handle open of a deleted file
Expand All @@ -140,7 +183,8 @@ Icon
# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### MacOS: https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore
# pytype static type analyzer
.pytype/

# General
.DS_Store
Expand Down Expand Up @@ -196,10 +240,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

### VScode: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore
.vscode/*
.vs/*

### Extra Python Items and SunPy Specific
.hypothesis
.pytest_cache
Expand All @@ -221,9 +261,11 @@ docs/guide/data_types/figure.png
october_M1_flares.csv
aia_map.fits
docs/tutorial/figure.png

### Pycharm
.idea
docs/whatsnew/latest_changelog.txt
examples/**/*.csv
figure_test_images*
tags
baseline

# Release script
.github_cache
Expand All @@ -239,7 +281,6 @@ package.json

# Log files generated by 'vagrant up'
*.log

# asv stuff
asv_env
asv_results
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exclude: "\\.asdf$"
repos:
# This should be before any formatting hooks like isort
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
hooks:
Expand Down

0 comments on commit 9c4ff1a

Please sign in to comment.