diff --git a/.cruft.json b/.cruft.json index 4f5e0e940..3e1f70069 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "fb26c9794c872939b7e72bc7f30b943628384a8e", + "commit": "4ba8b7c6a6bf4f51f7154978ae8d2f3710ef89e5", "checkout": null, "context": { "cookiecutter": { @@ -21,19 +21,20 @@ "use_compiled_extensions": "n", "enable_dynamic_dev_versions": "y", "include_example_code": "n", - "include_cruft_update_github_workflow": "y", + "include_cruft_update_github_workflow": "n", + "use_pat_in_cruft_update_workflow": "y", "use_extended_ruff_linting": "y", "matrix_room_id": "!TWSJXVpyflnZOzmSQz:matrix.org", + "extra_ci_jobs": "cron", "_sphinx_theme": "sunpy", "_parent_project": "", "_install_requires": "", "_copy_without_render": [ "docs/_templates", - "docs/_static", - ".github/workflows/sub_package_update.yml" + "docs/_static" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "fb26c9794c872939b7e72bc7f30b943628384a8e" + "_commit": "4ba8b7c6a6bf4f51f7154978ae8d2f3710ef89e5" } }, "directory": null diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e8eb01ec3..b66a0740e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: schedule: interval: "monthly" cooldown: - default-days: 7 + default-days: 14 # Most updates should be from the package template groups: actions: patterns: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52700d2a3..606bce804 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ permissions: {} jobs: core: - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@8c8bb6c6c962542921f993d47d26df38dccd50b1 # v3.0.2 with: submodules: false coverage: codecov @@ -37,10 +37,10 @@ jobs: sdist_verify: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses] + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses] + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: '3.13' - run: python -m pip install -U --user build @@ -50,7 +50,7 @@ jobs: test: needs: [core, sdist_verify] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@8c8bb6c6c962542921f993d47d26df38dccd50b1 # v3.0.2 with: submodules: false coverage: codecov @@ -67,7 +67,7 @@ jobs: docs: needs: [core] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@8c8bb6c6c962542921f993d47d26df38dccd50b1 # v3.0.2 with: default_python: '3.13' submodules: false @@ -91,12 +91,12 @@ 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@v2 # zizmor: ignore[unpinned-uses] + needs: [core] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@8c8bb6c6c962542921f993d47d26df38dccd50b1 # v3.0.2 with: - default_python: '3.13' submodules: false - coverage: codecov toxdeps: tox-pypi-filter + coverage: codecov envs: | - linux: py314-devdeps secrets: @@ -112,7 +112,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'Run publish') ) needs: [test, docs] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2 # zizmor: ignore[unpinned-uses] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@8c8bb6c6c962542921f993d47d26df38dccd50b1 # v3.0.2 with: python-version: '3.13' test_extras: 'all,tests' @@ -132,7 +132,7 @@ jobs: name: pypi steps: - name: Download artifacts - uses: actions/download-artifact@v8 # zizmor: ignore[unpinned-uses] + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: merge-multiple: true pattern: dist-* @@ -141,7 +141,7 @@ jobs: - run: ls -lha dist/ - name: Run upload - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 notify: if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }} @@ -150,7 +150,7 @@ jobs: environment: name: matrix steps: - - uses: Cadair/matrix-notify-action@main # zizmor: ignore[unpinned-uses] + - uses: Cadair/matrix-notify-action@31c7cc36051ee7dc4157a22c1f13dbc7d68e5120 # v2 with: workflow_description: 'CI Workflow' matrix_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} diff --git a/.github/workflows/label_sync.yml b/.github/workflows/label_sync.yml index 7f2177583..cc1d5fbd8 100644 --- a/.github/workflows/label_sync.yml +++ b/.github/workflows/label_sync.yml @@ -18,6 +18,6 @@ jobs: runs-on: ubuntu-latest name: Label Sync steps: - - uses: srealmoreno/label-sync-action@850ba5cef2b25e56c6c420c4feed0319294682fd + - uses: srealmoreno/label-sync-action@850ba5cef2b25e56c6c420c4feed0319294682fd # v2.0.0 with: config-file: https://raw.githubusercontent.com/sunpy/.github/main/labels.yml diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml deleted file mode 100644 index c81875654..000000000 --- a/.github/workflows/sub_package_update.yml +++ /dev/null @@ -1,165 +0,0 @@ -# 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 - -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 - -permissions: {} - -jobs: - update: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses] - with: - persist-credentials: false - - - uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses] - with: - python-version: "3.14" - - - name: Install Cruft - run: python -m pip install git+https://github.com/Cadair/cruft@patch-p1 - - - 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 - id: cruft_update - 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_output=$(cruft update --skip-apply-ask --refresh-private-variables) - echo $cruft_output - git restore --staged . - - if [[ "$cruft_output" == *"Failed to cleanly apply the update, there may be merge conflicts."* ]]; then - echo merge_conflicts=1 >> $GITHUB_OUTPUT - else - echo merge_conflicts=0 >> $GITHUB_OUTPUT - fi - - - name: Check if only .cruft.json is modified - id: cruft_json - if: steps.check.outputs.has_changes == '1' - run: | - git status --porcelain=1 - if [[ "$(git status --porcelain=1)" == " M .cruft.json" ]]; then - echo "Only .cruft.json is modified. Exiting workflow early." - echo "has_changes=0" >> "$GITHUB_OUTPUT" - else - echo "has_changes=1" >> "$GITHUB_OUTPUT" - fi - - - name: Create pull request - if: steps.cruft_json.outputs.has_changes == '1' - uses: peter-evans/create-pull-request@v8 # zizmor: ignore[unpinned-uses] - with: - token: ${{ secrets.GITHUB_TOKEN }} - add-paths: "." - commit-message: "Automatic package template update" - branch: "cruft/update" - delete-branch: true - draft: ${{ steps.cruft_update.outputs.merge_conflicts == '1' }} - title: "Updates from the package template" - labels: | - No Changelog Entry Needed - Backport 2.4 - body: | - This is an autogenerated PR, which will applies the latest changes from the [SunPy Package Template](https://github.com/sunpy/package-template). - If this pull request has been opened as a draft there are conflicts which need fixing. - - **To run the CI on this pull request you will need to close it and reopen it.** - - report-fail: - if: failure() - needs: [update] - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - name: Open an issue if workflow fails - uses: actions/github-script@v9 # zizmor: ignore[unpinned-uses] - with: - github-token: ${{ github.token }} - # This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action - # Under MIT license (c) Scientific Python Developers - script: | - const fs = require('fs'); - - // Edit these if needed for your repo - const variables = { - owner: context.repo.owner, - name: context.repo.repo, - label: "Infrastructure", - creator: "app/github-actions", - title: "SunPy Package Template auto-update failed." - }; - - const logs = 'The package update workflow failed.' - const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`; - const issue_body = `[Workflow Run URL](${workflow_url})\n${logs}`; - - const query_string = `repo:${variables.owner}/${variables.name} author:${variables.creator} label:${variables.label} is:open in:title ${variables.title}`; - - // Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures - const query = `query { - search(query: "${query_string}", type:ISSUE, first: 1) { - edges { - node { - ... on Issue { - body - id - number - } - } - } - } - }`; - - const result = await github.graphql(query); - - // If no issue is open, create a new issue, - // else update the body of the existing issue. - if (result.search.edges.length === 0) { - await github.rest.issues.create({ - owner: variables.owner, - repo: variables.name, - body: issue_body, - title: variables.title, - labels: [variables.label, "pre-commit.ci autofix"], - }); - } else { - await github.rest.issues.update({ - owner: variables.owner, - repo: variables.name, - issue_number: result.search.edges[0].node.number, - body: issue_body - }); - } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70acf99f8..67b3b8962 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,19 +1,19 @@ repos: - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.26.1 + rev: v1.28.0 hooks: - id: zizmor # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.20" + rev: "v0.16.1" hooks: - - id: ruff + - id: ruff-check args: ["--fix"] types: [python] # Define here once and then reference using YAML anchor exclude: &exclude_dirs ^ndcube/(data|extern)/ - repo: https://github.com/PyCQA/isort - rev: 9.0.0a3 + rev: 8.0.1 hooks: - id: isort types: [python] @@ -45,7 +45,7 @@ repos: - id: mixed-line-ending types_or: [python, rst] - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell args: [ "--write-changes" ] diff --git a/tox.ini b/tox.ini index e41473dc2..2e6dee00c 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,7 @@ pass_env = # If the user has set a LC override we should follow it LC_ALL set_env = + COVERAGE_FILE={toxinidir}/.coverage MPLBACKEND = agg COLUMNS = 180 PYTEST_COMMAND = pytest -vvv -r fEs --pyargs ndcube --cov-report=xml --cov=ndcube --cov-config={toxinidir}/.coveragerc {toxinidir}/docs