diff --git a/.cruft.json b/.cruft.json index fef8668..c1daec3 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/sunpy/package-template", - "commit": "4268346dead7b529a3d53df19bcf374bb2bbef34", + "commit": "9599f755e4f7880fe20f0f07bbf500d8c41de34d", "checkout": null, "context": { "cookiecutter": { @@ -23,6 +23,7 @@ "include_example_code": "n", "include_cruft_update_github_workflow": "y", "use_extended_ruff_linting": "y", + "matrix_room_id": "!jfEXWJFdXwYnBWsiqk:openastronomy.org", "_sphinx_theme": "sunpy", "_parent_project": "", "_install_requires": "", @@ -32,7 +33,7 @@ ".github/workflows/sub_package_update.yml" ], "_template": "https://github.com/sunpy/package-template", - "_commit": "4268346dead7b529a3d53df19bcf374bb2bbef34" + "_commit": "9599f755e4f7880fe20f0f07bbf500d8c41de34d" } }, "directory": null diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1e36725..5b87472 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,15 +1,12 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: - - package-ecosystem: "github-actions" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "github-actions" + directory: "/" schedule: - interval: "weekly" - - package-ecosystem: "Cargo" + interval: "monthly" + cooldown: + default-days: 7 + - package-ecosystem: "cargo" directory: "/" schedule: interval: "monthly" @@ -17,3 +14,5 @@ updates: rust: # group all rust deps into a single PR patterns: - "*" + cooldown: + default-days: 7 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c70007..2a7331c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,17 +27,21 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: rust: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: hecrj/setup-rust-action@v2 + - uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses] + with: + persist-credentials: false + - uses: hecrj/setup-rust-action@v2 # zizmor: ignore[unpinned-uses] - run: cargo test core: needs: [rust] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] with: submodules: false coverage: codecov @@ -50,8 +54,10 @@ jobs: sdist_verify: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - 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.13' - run: python -m pip install -U --user build @@ -60,8 +66,8 @@ jobs: - run: python -m twine check dist/* test: - needs: [core, sdist_verify, rust] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 + needs: [core, sdist_verify] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] with: submodules: false coverage: codecov @@ -79,7 +85,7 @@ jobs: docs: needs: [core] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2 # zizmor: ignore[unpinned-uses] with: default_python: '3.13' submodules: false @@ -91,7 +97,7 @@ jobs: envs: | - linux: build_docs - publish: + build_dists: # Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.* # see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi if: | @@ -101,12 +107,11 @@ jobs: contains(github.event.pull_request.labels.*.name, 'Run publish') ) needs: [test, docs] - uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v2 + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v2 # zizmor: ignore[unpinned-uses] with: sdist: true test_extras: 'tests' test_command: 'pytest -p no:warnings --doctest-rst --pyargs streamtracer' - submodules: false targets: | - cp3{12,13,14}-manylinux_x86_64 - cp3{12,13,14}-musllinux_x86_64 @@ -115,20 +120,45 @@ jobs: - cp3{12,13,14}-win_amd64 - target: cp3{12,13,14}-manylinux_aarch64 runs-on: ubuntu-24.04-arm - secrets: - pypi_token: ${{ secrets.pypi_token }} + submodules: false + save_artifacts: true + upload_to_pypi: false + + publish: + if: startsWith(github.ref, 'refs/tags/v') + name: Upload to PyPI + runs-on: ubuntu-latest + needs: [build_dists] + permissions: + id-token: write + environment: + name: pypi + steps: + - name: Download artifacts + uses: actions/download-artifact@v8 # zizmor: ignore[unpinned-uses] + with: + merge-multiple: true + pattern: dist-* + path: dist + + - run: ls -lha dist/ + + - name: Run upload + uses: pypa/gh-action-pypi-publish@v1.13.0 # zizmor: ignore[unpinned-uses] notify: - if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') - needs: [publish] + if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }} + needs: [build_dists] runs-on: ubuntu-latest + environment: + name: matrix steps: - - uses: Cadair/matrix-notify-action@main + - uses: Cadair/matrix-notify-action@main # zizmor: ignore[unpinned-uses] with: - matrix_token: ${{ secrets.matrix_access_token }} + workflow_description: "CI Workflow in sunpy/streamtracer" + matrix_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} - homeserver: ${{ secrets.matrix_homeserver }} + homeserver: ${{ secrets.MATRIX_HOMESERVER }} roomid: '!jfEXWJFdXwYnBWsiqk:openastronomy.org' - ignore_pattern: '.*Load.*' + ignore_pattern: '.*(Load|report overall).*' summarise_success: true - workflow_description: 'in sunpy/streamtracer' diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 00cc92c..1827e35 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -7,14 +7,16 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: run: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: 3.x - - uses: pre-commit/action@v3.0.1 - - uses: pre-commit-ci/lite-action@v1.1.0 - if: always() + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 diff --git a/.github/workflows/sub_package_update.yml b/.github/workflows/sub_package_update.yml index bc25572..74d158a 100644 --- a/.github/workflows/sub_package_update.yml +++ b/.github/workflows/sub_package_update.yml @@ -13,18 +13,20 @@ on: # │ │ │ │ ┌───────── 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 - strategy: - fail-fast: true steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v6 # zizmor: ignore[unpinned-uses] + with: + persist-credentials: false - - uses: actions/setup-python@v6 + - uses: actions/setup-python@v6 # zizmor: ignore[unpinned-uses] with: python-version: "3.14" @@ -50,8 +52,8 @@ jobs: 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 }}" + 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 @@ -77,7 +79,7 @@ jobs: - name: Create pull request if: steps.cruft_json.outputs.has_changes == '1' - uses: peter-evans/create-pull-request@v8 + uses: peter-evans/create-pull-request@v8 # zizmor: ignore[unpinned-uses] with: token: ${{ secrets.GITHUB_TOKEN }} add-paths: "." @@ -102,7 +104,7 @@ jobs: issues: write steps: - name: Open an issue if workflow fails - uses: actions/github-script@v7 + uses: actions/github-script@v8 # zizmor: ignore[unpinned-uses] with: github-token: ${{ github.token }} # This script is adapted from https://github.com/scientific-python/issue-from-pytest-log-action @@ -150,7 +152,7 @@ jobs: repo: variables.name, body: issue_body, title: variables.title, - labels: [variables.label], + labels: [variables.label, "pre-commit.ci autofix"], }); } else { await github.rest.issues.update({ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0258f20..1b4a367 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,54 +1,82 @@ repos: + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.23.1 + hooks: + - id: zizmor # This should be before any formatting hooks like isort - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.15.4" hooks: - id: ruff args: ["--fix"] + types: [python] + # Define here once and then reference using YAML anchor + exclude: &exclude_dirs ^streamtracer/(data|extern)/ - repo: https://github.com/PyCQA/isort rev: 8.0.1 hooks: - id: isort - exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|streamtracer/extern)$" + types: [python] + exclude: *exclude_dirs - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-ast + types: [python] + exclude: *exclude_dirs - id: check-case-conflict + types: [python] + exclude: *exclude_dirs - id: trailing-whitespace - exclude: ".*(.fits|.fts|.fit|.header|.txt)$" + types_or: [python, rst, rust] - id: check-yaml + types: [yaml] + exclude: *exclude_dirs + - id: check-toml + types: [toml] + exclude: *exclude_dirs - id: debug-statements + types: [python, rust] + exclude: *exclude_dirs - id: check-added-large-files args: ["--enforce-all", "--maxkb=1054"] - id: end-of-file-fixer - exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$" + types_or: [python, rst, rust] - id: mixed-line-ending - exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$" + types_or: [python, rst, rust] - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: - id: codespell args: [ "--write-changes" ] + types_or: [python, rst, rust] + exclude: *exclude_dirs # Run mypy type validation - repo: https://github.com/pre-commit/mirrors-mypy rev: 'v1.10.0' hooks: - id: mypy + types: [python] + exclude: *exclude_dirs additional_dependencies: [types-setuptools] # Python code formatting - repo: https://github.com/psf/black rev: 24.4.2 hooks: - id: black + types: [python] + exclude: *exclude_dirs # Rust code formatting - repo: https://github.com/FeryET/pre-commit-rust rev: v1.1.0 hooks: - id: cargo-check + types: [rust] - id: clippy args: ["--allow-staged", "--fix", "--", "-A", "clippy::needless_return", "-W", "clippy::implicit_return"] + types: [rust] - id: fmt + types: [rust] ci: autofix_prs: false autoupdate_schedule: "quarterly" diff --git a/README.rst b/README.rst index 1e6aced..b0d8da5 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,11 @@ Fast streamline tracing in python |Documentation Status| |Build Status| |codecov| +Documentation +------------- + +For full documentation, including installation instructions, see https://docs.sunpy.org/projects/streamtracer + Usage of Generative AI ---------------------- @@ -13,11 +18,24 @@ We expect authentic engagement in our community. If you use generative AI tools as an aid in developing code or documentation changes, ensure that you fully understand the proposed changes and can explain why they are the correct approach and an improvement to the current state. For more information see our documentation on fair and appropriate `AI usage `__. +Contributing +------------ -Documentation -------------- +We love contributions! streamtracer is open source, +built on open source, and we'd love to have you hang out in our community. -For full documentation, including installation instructions, see https://docs.sunpy.org/projects/streamtracer +If you would like to get involved, check out the `Developers Guide`_ section of the SunPy docs. +Stop by our chat room `#sunpy:openastronomy.org`_ if you have any questions. +Help is always welcome so let us know what you like to work on, or check out the `issues page`_ for the list of known outstanding items. + +For more information on contributing to SunPy, please read our `Newcomers' guide`_. + +.. _Developers Guide: https://docs.sunpy.org/en/latest/dev_guide/index.html +.. _`#sunpy:openastronomy.org`: https://app.element.io/#/room/#sunpy:openastronomy.org +.. _issues page: https://github.com/sunpy/streamtracer/issues +.. _Newcomers' guide: https://docs.sunpy.org/en/latest/dev_guide/contents/newcomers.html + +When you are interacting with the SunPy community you are asked at to follow our `code of conduct `__. .. |Documentation Status| image:: https://readthedocs.org/projects/streamtracer/badge/?version=stable :target: https://docs.sunpy.org/projects/streamtracer/en/stable/?badge=stable