diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..dcdcfb6 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,36 @@ +**Describe the change in this PR at a high-level** + +e.g., +> This PR adds a new model, originally published in [CITATION], which ... + +**Link any related issues, discussions, PRs** + +Include links to any related issues, discussion or PRs using GitHub's `#` syntax. e.g., + +> This closes issue #350 + +**Outstanding questions / particular feedback** + +List any questions you would like input on or parts of the PR you want reviewers to pay particular attention to, e.g., + +> - I think this can be made more efficient, any ideas? +> - Not sure if my tests make sense, make sure to check them out. + +**Describe changes** + +In a list, describe the changes you made. This should be more granular than the description at the beginning of the PR. These descriptions can be short, but this would also be the place to describe why something seemingly unrelated was included. e.g., + +> - added tests of new model +> - added docs describing new model +> - updated old tests for new API +> - small change to synthesis to be compatible with new API +> - while implementing this, a new version of torch was released, which required a small update to perceptual_distance.py + +**Checklist** + +Affirm that you have done the following: + +- [ ] I have described the changes in this PR, following the template above. +- [ ] I have added any necessary tests. +- [ ] I have added any necessary documentation. This includes docstrings, updates to existing files found in `docs/`, or (for large changes) adding new files to the `docs/` folder. +- [ ] If a new notebook was added: I have added the name of the new notebook to the matrix.notebook variable in `.github/workflows/ci.yml`. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbf2da2..e0b3fb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,36 +10,43 @@ on: branches: - main +permissions: {} + jobs: - # based on https://slashgear.github.io/how-to-split-test-by-folder-with-github-action/ - get_notebooks: - runs-on: ubuntu-latest - outputs: - notebook: ${{ steps.get-notebooks.outputs.nb }} - steps: - - uses: actions/checkout@v4 - - id: get-notebooks - # it's weird to me, but the quotes around \n should *not* be escaped or it breaks - run: "echo \"nb=$(ls TUTORIALS/*ipynb | jq -R -s -c 'split(\"\\n\")[:-1]')\"\ - \ >> $GITHUB_OUTPUT\n" notebooks: runs-on: ubuntu-latest - needs: [get_notebooks] strategy: matrix: - python-version: [3.9, '3.10', '3.11', '3.12', '3.13', '3.14'] - notebook: ${{fromJson(needs.get_notebooks.outputs.notebook)}} + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] + notebook: ["01_tools.ipynb", "02_pyramids.ipynb", "03_steerable_pyramids.ipynb"] fail-fast: false name: Execute notebooks steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0 with: python-version: ${{ matrix.python-version }} cache: pip cache-dependency-path: setup.py - - name: Setup FFmpeg - uses: FedericoCarboni/setup-ffmpeg@v3.1 + - name: Load cached FFmpeg + id: cache-ffmpeg + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 + with: + path: | + /usr/local/bin/ffmpeg + /usr/local/bin/ffprobe + key: ${{ runner.os }}-ffmpeg-5.1.1 + - name: Install FFmpeg if not cached + if: steps.cache-ffmpeg.outputs.cache-hit != 'true' + run: | + VERSION=6.0.1 + RELEASE_NAME=ffmpeg-${VERSION}-amd64-static + wget --timeout=8 --tries=30 https://www.johnvansickle.com/ffmpeg/old-releases/${RELEASE_NAME}.tar.xz + tar -xf ${RELEASE_NAME}.tar.xz + mv ${RELEASE_NAME}/ffmpeg ${RELEASE_NAME}/ffprobe /usr/local/bin/ + rm -rf ${RELEASE_NAME} - name: Install dependencies # nbclient 0.5.5 is the first version that includes jupyter execute run: | @@ -47,19 +54,21 @@ jobs: pip install jupyter ipywidgets pip install "nbclient>=0.5.5" - name: Run notebooks - run: jupyter execute ${{ matrix.notebook }} --kernel_name=python3 + run: jupyter execute TUTORIALS/${{ matrix.notebook }} --kernel_name=python3 tests: runs-on: ${{matrix.os}} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.9, '3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15'] fail-fast: false name: Run tests steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Install Python 3 - uses: actions/setup-python@v5 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0 with: python-version: ${{ matrix.python-version }} cache: pip @@ -80,27 +89,30 @@ jobs: # generate the xml file and move it to root dir for codecov coverage xml -o ../coverage.xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@a079530fc142d3d288ddf76321ca0b7fe5b18df5 # v4.4.1 + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 with: token: ${{ secrets.CODECOV_TOKEN }} all_tutorials_in_docs: runs-on: ubuntu-latest name: Check that all tutorial notebooks are included in docs - needs: [get_notebooks] strategy: matrix: - notebook: ${{fromJson(needs.get_notebooks.outputs.notebook)}} + notebook: ["01_tools.ipynb", "02_pyramids.ipynb", "03_steerable_pyramids.ipynb"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Check for file shell: bash - run: if [[ -z "$(grep ${{ matrix.notebook }} docs/tutorials/*nblink)" ]] ; then + run: if [[ -z "$(grep TUTORIALS/${{ matrix.notebook }} docs/tutorials/*nblink)" ]] ; then exit 1; fi no_extra_nblinks: runs-on: ubuntu-latest name: Check that we don't have any extra nblink files steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Check same number of nblink and notebooks shell: bash run: | @@ -116,6 +128,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Decide whether all tests and notebooks succeeded - uses: re-actors/alls-green@afee1c1eac2a506084c274e9c02c8e0687b48d9e # v1.2.2 + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 with: jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index addadae..467156a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,8 @@ on: types: [published] workflow_dispatch: +permissions: {} + jobs: build-wheels: name: Make ${{ matrix.os }} wheels @@ -14,10 +16,12 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Build wheels - uses: pypa/cibuildwheel@v4.2.0 + uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 env: CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-* cp314-* CIBW_SKIP: '*musllinux*' @@ -29,7 +33,7 @@ jobs: CIBW_ARCHS_MACOS: x86_64 arm64 - name: Upload wheel as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: artifact-${{ matrix.os }}-wheel path: ./**/*.whl @@ -38,11 +42,13 @@ jobs: name: Make source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - run: pipx run build --sdist - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: artifact-source-dist path: ./**/dist/*.tar.gz @@ -56,7 +62,7 @@ jobs: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - name: Download all artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 - name: Copy artifacts to dist/ folder run: | find . -name 'artifact-*' -exec unzip '{}' \; @@ -65,9 +71,9 @@ jobs: find . -name '*.whl' -exec mv '{}' dist/ \; - name: Publish package to test pypi if: github.event_name == 'release' && github.event.action == 'published' - uses: pypa/gh-action-pypi-publish@v1.13.0 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 - name: Publish package to test pypi if: github.event_name != 'release' - uses: pypa/gh-action-pypi-publish@v1.13.0 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000..18166eb --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,24 @@ +name: GitHub Actions Security Analysis with zizmor 🌈 + +on: + push: + branches: ["main"] + pull_request: + branches: ["**"] + +permissions: {} + +jobs: + zizmor: + name: Run zizmor 🌈 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Run zizmor 🌈 + uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0 + with: + advanced-security: false + inputs: .github/workflows diff --git a/README.md b/README.md index 03047ad..aaacc69 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![PyPI Version](https://img.shields.io/pypi/v/pyrtools.svg)](https://pypi.org/project/pyrtools/) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyrtools/badges/version.svg)](https://anaconda.org/conda-forge/pyrtools) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/LabForComputationalVision/pyrtools/blob/main/LICENSE) -![Python version](https://img.shields.io/badge/python-3.9|3.10|3.11|3.12|3.13|3.14-blue.svg) +![Python version](https://img.shields.io/badge/python-3.10|3.11|3.12|3.13|3.14|3.15-blue.svg) [![Build Status](https://github.com/LabForComputationalVision/pyrtools/workflows/build/badge.svg)](https://github.com/LabForComputationalVision/pyrtools/actions?query=workflow%3Abuild) [![Documentation Status](https://readthedocs.org/projects/pyrtools/badge/?version=latest)](https://pyrtools.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/137527035.svg)](https://zenodo.org/doi/10.5281/zenodo.10161031) diff --git a/docs/index.rst b/docs/index.rst index d05587b..a8f113e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,7 +7,7 @@ .. |license-shield| image:: https://img.shields.io/badge/license-MIT-yellow.svg :target: https://github.com/LabForComputationalVision/pyrtools/blob/main/LICENSE -.. |python-version-shield| image:: https://img.shields.io/badge/python-3.9%7C3.10%7C3.11%7C3.12%7C3.13%7C3.14-blue.svg +.. |python-version-shield| image:: https://img.shields.io/badge/python-3.10%7C3.11%7C3.12%7C3.13%7C3.14%7C3.15-blue.svg .. |build| image:: https://github.com/LabForComputationalVision/pyrtools/workflows/build/badge.svg :target: https://github.com/LabForComputationalVision/pyrtools/actions?query=workflow%3Abuild diff --git a/pyproject.toml b/pyproject.toml index d469b17..d050e3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ authors = [{name="Pyrtools authors"}] description = "Python tools for multi-scale image processing, including Laplacian pyramids, Wavelets, and Steerable Pyramids." readme = "README.md" license = "MIT" -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3",