diff --git a/.codecov.yaml b/.codecov.yaml index 829e56c03..d0c0e2917 100644 --- a/.codecov.yaml +++ b/.codecov.yaml @@ -1,17 +1,17 @@ # Based on pydata/xarray codecov: - require_ci_to_pass: no + require_ci_to_pass: no coverage: - status: - project: - default: - # Require 1% coverage, i.e., always succeed - target: 1 - patch: false - changes: false + status: + project: + default: + # Require 1% coverage, i.e., always succeed + target: 1 + patch: false + changes: false comment: - layout: diff, flags, files - behavior: once - require_base: no + layout: diff, flags, files + behavior: once + require_base: no diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7c384ca1f..db6d6dfb6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -2,115 +2,115 @@ name: Bug report description: Report something that is broken or incorrect type: Bug body: - - type: markdown - attributes: - value: | - **Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) - detailing how to provide the necessary information for us to reproduce your bug. In brief: - * Please provide exact steps how to reproduce the bug in a clean Python environment. - * In case it's not clear what's causing this bug, please provide the data or the data generation procedure. - * Replicate problems on public datasets or share data subsets when full sharing isn't possible. + - type: markdown + attributes: + value: | + **Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) + detailing how to provide the necessary information for us to reproduce your bug. In brief: + * Please provide exact steps how to reproduce the bug in a clean Python environment. + * In case it's not clear what's causing this bug, please provide the data or the data generation procedure. + * Replicate problems on public datasets or share data subsets when full sharing isn't possible. - Generally, the easier it is for us to reproduce the issue, the faster we can work on it. If you can, please: + Generally, the easier it is for us to reproduce the issue, the faster we can work on it. If you can, please: - 1. Reproduce using the [`blobs` dataset](https://spatialdata.scverse.org/en/stable/api/datasets.html#spatialdata.datasets.blobs): + 1. Reproduce using the [`blobs` dataset](https://spatialdata.scverse.org/en/stable/api/datasets.html#spatialdata.datasets.blobs): - ```python - from spatialdata.datasets import blobs + ```python + from spatialdata.datasets import blobs - sdata = blobs() - ``` + sdata = blobs() + ``` - You can also use [`blobs_annotating_element`](https://spatialdata.scverse.org/en/stable/api/datasets.html#spatialdata.datasets.blobs_annotating_element) for more control: + You can also use [`blobs_annotating_element`](https://spatialdata.scverse.org/en/stable/api/datasets.html#spatialdata.datasets.blobs_annotating_element) for more control: - ```python - from spatialdata.datasets import blobs_annotating_element + ```python + from spatialdata.datasets import blobs_annotating_element - sdata = blobs_annotating_element("blobs_labels") - ``` + sdata = blobs_annotating_element("blobs_labels") + ``` - 2. If the above is not possible, reproduce using a public dataset and explain how we can download the data. - 3. If the data is private, consider sharing an anonymized version/subset via a [Zulip private message](https://scverse.zulipchat.com/#user/480560), or provide screenshots/GIFs showing the behavior. + 2. If the above is not possible, reproduce using a public dataset and explain how we can download the data. + 3. If the data is private, consider sharing an anonymized version/subset via a [Zulip private message](https://scverse.zulipchat.com/#user/480560), or provide screenshots/GIFs showing the behavior. - Please report only one bug per issue. + Please report only one bug per issue. - - type: textarea - id: report - attributes: - label: Report - description: A clear and concise description of what the bug is. - validations: - required: true + - type: textarea + id: report + attributes: + label: Report + description: A clear and concise description of what the bug is. + validations: + required: true - - type: textarea - id: versions - attributes: - label: Versions - description: | - Which version of packages. + - type: textarea + id: versions + attributes: + label: Versions + description: | + Which version of packages. - Please install `session-info2`, run the following command in a notebook, - click the “Copy as Markdown” button, then paste the results into the text box below. + Please install `session-info2`, run the following command in a notebook, + click the “Copy as Markdown” button, then paste the results into the text box below. - ```python - In[1]: import session_info2; session_info2.session_info(dependencies=True) - ``` + ```python + In[1]: import session_info2; session_info2.session_info(dependencies=True) + ``` - Alternatively, run this in a console: + Alternatively, run this in a console: - ```python - >>> import session_info2; print(session_info2.session_info(dependencies=True)._repr_mimebundle_()["text/markdown"]) - ``` - render: python - placeholder: | - anndata 0.11.3 - ---- ---- - charset-normalizer 3.4.1 - coverage 7.7.0 - psutil 7.0.0 - dask 2024.7.1 - jaraco.context 5.3.0 - numcodecs 0.15.1 - jaraco.functools 4.0.1 - Jinja2 3.1.6 - sphinxcontrib-jsmath 1.0.1 - sphinxcontrib-htmlhelp 2.1.0 - toolz 1.0.0 - session-info2 0.1.2 - PyYAML 6.0.2 - llvmlite 0.44.0 - scipy 1.15.2 - pandas 2.2.3 - sphinxcontrib-devhelp 2.0.0 - h5py 3.13.0 - tblib 3.0.0 - setuptools-scm 8.2.0 - more-itertools 10.3.0 - msgpack 1.1.0 - sparse 0.15.5 - wrapt 1.17.2 - jaraco.collections 5.1.0 - numba 0.61.0 - pyarrow 19.0.1 - pytz 2025.1 - MarkupSafe 3.0.2 - crc32c 2.7.1 - sphinxcontrib-qthelp 2.0.0 - sphinxcontrib-serializinghtml 2.0.0 - zarr 2.18.4 - asciitree 0.3.3 - six 1.17.0 - sphinxcontrib-applehelp 2.0.0 - numpy 2.1.3 - cloudpickle 3.1.1 - sphinxcontrib-bibtex 2.6.3 - natsort 8.4.0 - jaraco.text 3.12.1 - setuptools 76.1.0 - Deprecated 1.2.18 - packaging 24.2 - python-dateutil 2.9.0.post0 - ---- ---- - Python 3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0] - OS Linux-6.11.0-109019-tuxedo-x86_64-with-glibc2.39 - Updated 2025-03-18 15:47 + ```python + >>> import session_info2; print(session_info2.session_info(dependencies=True)._repr_mimebundle_()["text/markdown"]) + ``` + render: python + placeholder: | + anndata 0.11.3 + ---- ---- + charset-normalizer 3.4.1 + coverage 7.7.0 + psutil 7.0.0 + dask 2024.7.1 + jaraco.context 5.3.0 + numcodecs 0.15.1 + jaraco.functools 4.0.1 + Jinja2 3.1.6 + sphinxcontrib-jsmath 1.0.1 + sphinxcontrib-htmlhelp 2.1.0 + toolz 1.0.0 + session-info2 0.1.2 + PyYAML 6.0.2 + llvmlite 0.44.0 + scipy 1.15.2 + pandas 2.2.3 + sphinxcontrib-devhelp 2.0.0 + h5py 3.13.0 + tblib 3.0.0 + setuptools-scm 8.2.0 + more-itertools 10.3.0 + msgpack 1.1.0 + sparse 0.15.5 + wrapt 1.17.2 + jaraco.collections 5.1.0 + numba 0.61.0 + pyarrow 19.0.1 + pytz 2025.1 + MarkupSafe 3.0.2 + crc32c 2.7.1 + sphinxcontrib-qthelp 2.0.0 + sphinxcontrib-serializinghtml 2.0.0 + zarr 2.18.4 + asciitree 0.3.3 + six 1.17.0 + sphinxcontrib-applehelp 2.0.0 + numpy 2.1.3 + cloudpickle 3.1.1 + sphinxcontrib-bibtex 2.6.3 + natsort 8.4.0 + jaraco.text 3.12.1 + setuptools 76.1.0 + Deprecated 1.2.18 + packaging 24.2 + python-dateutil 2.9.0.post0 + ---- ---- + Python 3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0] + OS Linux-6.11.0-109019-tuxedo-x86_64-with-glibc2.39 + Updated 2025-03-18 15:47 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 5cad625d1..5b62547f9 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Scverse Community Forum - url: https://discourse.scverse.org/ - about: If you have questions about “How to do X”, please ask them here. + - name: Scverse Community Forum + url: https://discourse.scverse.org/ + about: If you have questions about “How to do X”, please ask them here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 0a097352a..dad5ba977 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -2,10 +2,10 @@ name: Feature request description: Propose a new feature for spatialdata type: Enhancement body: - - type: textarea - id: description - attributes: - label: Description of feature - description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered. - validations: - required: true + - type: textarea + id: description + attributes: + label: Description of feature + description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered. + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d13eff43a..4e006078c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,26 +1,26 @@ version: 2 updates: - - package-ecosystem: pre-commit - directory: / - schedule: - interval: weekly - cooldown: - default-days: 7 - groups: - pre-commit: - patterns: ["*"] - - package-ecosystem: github-actions - directory: / - schedule: - interval: weekly - cooldown: - default-days: 7 - groups: - actions-deps: - patterns: - - "*" - # docs/tutorials/notebooks -> scverse/spatialdata-tutorials - - package-ecosystem: gitsubmodule - directory: / - schedule: - interval: weekly + - package-ecosystem: pre-commit + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 + groups: + pre-commit: + patterns: ["*"] + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 + groups: + actions-deps: + patterns: + - "*" + # docs/tutorials/notebooks -> scverse/spatialdata-tutorials + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly diff --git a/.github/release.yml b/.github/release.yml index fe7b92b74..4070fe995 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,29 +1,29 @@ changelog: - exclude: - labels: - - release-ignore - authors: - - pre-commit-ci - - pre-commit-ci[bot] - categories: - - title: Added - labels: - - "release-added" - - title: Changed - labels: - - "release-changed" - - title: Deprecated - labels: - - "release-deprecated" - - title: Removed - labels: - - "release-removed" - - title: Fixed - labels: - - "release-fixed" - - title: Security - labels: - - "release-security" - - title: Other Changes - labels: - - "*" + exclude: + labels: + - release-ignore + authors: + - pre-commit-ci + - pre-commit-ci[bot] + categories: + - title: Added + labels: + - "release-added" + - title: Changed + labels: + - "release-changed" + - title: Deprecated + labels: + - "release-deprecated" + - title: Removed + labels: + - "release-removed" + - title: Fixed + labels: + - "release-fixed" + - title: Security + labels: + - "release-security" + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/autofix.yaml b/.github/workflows/autofix.yaml index e5614bf9f..c094ca811 100644 --- a/.github/workflows/autofix.yaml +++ b/.github/workflows/autofix.yaml @@ -3,30 +3,30 @@ name: autofix.ci on: - pull_request: + pull_request: env: - FORCE_COLOR: "1" - UV_COMPILE_BYTECODE: "1" + FORCE_COLOR: "1" + UV_COMPILE_BYTECODE: "1" permissions: - contents: read + contents: read jobs: - lint: - name: Pre-commit checks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - filter: blob:none - persist-credentials: false - - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - with: - enable-cache: true - - run: uv tool install hatch - - name: Run pre-commit hooks - run: uvx prek run --all-files --show-diff-on-failure --color=always - - uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4 - if: ${{ !cancelled() }} + lint: + name: Pre-commit checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + filter: blob:none + persist-credentials: false + - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: true + - run: uv tool install hatch + - name: Run pre-commit hooks + run: uvx prek run --all-files --show-diff-on-failure --color=always + - uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4 + if: ${{ !cancelled() }} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 81818723f..352b9a2d0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,32 +1,32 @@ name: Check Build on: - push: - branches: [main] - pull_request: - branches: [main] + push: + branches: [main] + pull_request: + branches: [main] concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read jobs: - package: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - filter: blob:none - fetch-depth: 0 - persist-credentials: false - - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - with: - enable-cache: false - - name: Build package - run: uv build - - name: Check package - run: uvx twine check --strict dist/*.whl + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + filter: blob:none + fetch-depth: 0 + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: false + - name: Build package + run: uv build + - name: Check package + run: uvx twine check --strict dist/*.whl diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml index 93e741586..921004b72 100644 --- a/.github/workflows/build_image.yml +++ b/.github/workflows/build_image.yml @@ -1,106 +1,106 @@ name: Build Docker image on: - workflow_dispatch: - # schedule: - # - cron: "0 0 * * *" # run daily at midnight UTC + workflow_dispatch: + # schedule: + # - cron: "0 0 * * *" # run daily at midnight UTC env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read jobs: - build: - runs-on: ubuntu-latest - - defaults: - run: - shell: bash -e {0} # -e to fail on error - - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: - - name: Checkout code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - filter: blob:none - persist-credentials: false - - - name: Set up Python - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 - with: - python-version: "3.x" - - - name: Upgrade pip - run: pip install pip - - - name: Get latest versions - id: get_versions - run: | - SPATIALDATA_VERSION=$(pip index versions spatialdata | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') - SPATIALDATA_IO_VERSION=$(pip index versions spatialdata-io | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') - SPATIALDATA_PLOT_VERSION=$(pip index versions spatialdata-plot | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') - echo "SPATIALDATA_VERSION=${SPATIALDATA_VERSION}" >> $GITHUB_ENV - echo "SPATIALDATA_IO_VERSION=${SPATIALDATA_IO_VERSION}" >> $GITHUB_ENV - echo "SPATIALDATA_PLOT_VERSION=${SPATIALDATA_PLOT_VERSION}" >> $GITHUB_ENV - - - name: Check if image tag exists - id: check_tag - env: - IMAGE_TAG_SUFFIX: spatialdata${{ env.SPATIALDATA_VERSION }}_spatialdata-io${{ env.SPATIALDATA_IO_VERSION }}_spatialdata-plot${{ env.SPATIALDATA_PLOT_VERSION }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Define the API URL - API_URL="https://api.github.com/orgs/scverse/packages/container/spatialdata/versions" - - # Fetch all existing versions - existing_tags=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $API_URL | jq -r '.[].metadata.container.tags[]') - - # Debug: Output all existing tags - echo "Existing tags:" - echo "$existing_tags" - - # Check if the constructed tag exists - if echo "$existing_tags" | grep -q "$IMAGE_TAG_SUFFIX"; then - echo "Image tag $IMAGE_TAG_SUFFIX already exists. Skipping build." - echo "skip_build=true" >> $GITHUB_ENV - else - echo "Image tag $IMAGE_TAG_SUFFIX does not exist. Proceeding with build." - echo "skip_build=false" >> $GITHUB_ENV - echo "IMAGE_TAG_SUFFIX=${IMAGE_TAG_SUFFIX}" >> $GITHUB_ENV - fi - - - name: Login to GitHub Container Registry - if: ${{ env.skip_build == 'false' }} - uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 - if: ${{ env.skip_build == 'false' }} - env: - IMAGE_TAG: ${{ env.REGISTRY }}/scverse/spatialdata:${{ env.IMAGE_TAG_SUFFIX }} - with: - context: . - file: ./Dockerfile - push: true - cache-from: type=registry,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache - cache-to: type=inline,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache - build-args: | - SPATIALDATA_VERSION=${{ env.SPATIALDATA_VERSION }} - SPATIALDATA_IO_VERSION=${{ env.SPATIALDATA_IO_VERSION }} - SPATIALDATA_PLOT_VERSION=${{ env.SPATIALDATA_PLOT_VERSION }} - tags: ${{ env.IMAGE_TAG }} + build: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -e {0} # -e to fail on error + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + filter: blob:none + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: "3.x" + + - name: Upgrade pip + run: pip install pip + + - name: Get latest versions + id: get_versions + run: | + SPATIALDATA_VERSION=$(pip index versions spatialdata | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') + SPATIALDATA_IO_VERSION=$(pip index versions spatialdata-io | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') + SPATIALDATA_PLOT_VERSION=$(pip index versions spatialdata-plot | grep "Available versions" | sed 's/Available versions: //' | awk -F', ' '{print $1}') + echo "SPATIALDATA_VERSION=${SPATIALDATA_VERSION}" >> $GITHUB_ENV + echo "SPATIALDATA_IO_VERSION=${SPATIALDATA_IO_VERSION}" >> $GITHUB_ENV + echo "SPATIALDATA_PLOT_VERSION=${SPATIALDATA_PLOT_VERSION}" >> $GITHUB_ENV + + - name: Check if image tag exists + id: check_tag + env: + IMAGE_TAG_SUFFIX: spatialdata${{ env.SPATIALDATA_VERSION }}_spatialdata-io${{ env.SPATIALDATA_IO_VERSION }}_spatialdata-plot${{ env.SPATIALDATA_PLOT_VERSION }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Define the API URL + API_URL="https://api.github.com/orgs/scverse/packages/container/spatialdata/versions" + + # Fetch all existing versions + existing_tags=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $API_URL | jq -r '.[].metadata.container.tags[]') + + # Debug: Output all existing tags + echo "Existing tags:" + echo "$existing_tags" + + # Check if the constructed tag exists + if echo "$existing_tags" | grep -q "$IMAGE_TAG_SUFFIX"; then + echo "Image tag $IMAGE_TAG_SUFFIX already exists. Skipping build." + echo "skip_build=true" >> $GITHUB_ENV + else + echo "Image tag $IMAGE_TAG_SUFFIX does not exist. Proceeding with build." + echo "skip_build=false" >> $GITHUB_ENV + echo "IMAGE_TAG_SUFFIX=${IMAGE_TAG_SUFFIX}" >> $GITHUB_ENV + fi + + - name: Login to GitHub Container Registry + if: ${{ env.skip_build == 'false' }} + uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 + if: ${{ env.skip_build == 'false' }} + env: + IMAGE_TAG: ${{ env.REGISTRY }}/scverse/spatialdata:${{ env.IMAGE_TAG_SUFFIX }} + with: + context: . + file: ./Dockerfile + push: true + cache-from: type=registry,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache + cache-to: type=inline,ref=${{ env.REGISTRY }}/scverse/spatialdata:buildcache + build-args: | + SPATIALDATA_VERSION=${{ env.SPATIALDATA_VERSION }} + SPATIALDATA_IO_VERSION=${{ env.SPATIALDATA_IO_VERSION }} + SPATIALDATA_PLOT_VERSION=${{ env.SPATIALDATA_PLOT_VERSION }} + tags: ${{ env.IMAGE_TAG }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1fea290e3..ced9482bc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,33 +1,33 @@ name: Release on: - release: - types: [published] + release: + types: [published] # Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/ permissions: {} jobs: - release: - name: Upload release to PyPI - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/spatialdata - permissions: - contents: read - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - filter: blob:none - fetch-depth: 0 - persist-credentials: false - - name: Install uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - with: - enable-cache: false - - name: Build package - run: uv build - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 + release: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/spatialdata + permissions: + contents: read + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + filter: blob:none + fetch-depth: 0 + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: false + - name: Build package + run: uv build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 315a2b0db..5c5cb9f1e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,103 +1,103 @@ name: Test on: - push: - branches: [main] - pull_request: - branches: [main] - schedule: - - cron: "0 5 1,15 * *" + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 5 1,15 * *" concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: - contents: read + contents: read jobs: - # [tool.hatch.envs.hatch-test.matrix] in pyproject.toml is the single source of truth: the same environments run here and locally. - get-environments: - runs-on: ubuntu-slim - outputs: - envs: ${{ steps.get-envs.outputs.envs }} - steps: - - &clone - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - filter: blob:none - fetch-depth: 0 - persist-credentials: false - - &setup-uv - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 - with: - prune-cache: true - - name: Get test environments - id: get-envs - run: | - ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries - | map( - select(.key | startswith("hatch-test")) - | { - name: .key, - label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end), - python: .value.python - } - )') - echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT + # [tool.hatch.envs.hatch-test.matrix] in pyproject.toml is the single source of truth: the same environments run here and locally. + get-environments: + runs-on: ubuntu-slim + outputs: + envs: ${{ steps.get-envs.outputs.envs }} + steps: + - &clone + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + filter: blob:none + fetch-depth: 0 + persist-credentials: false + - &setup-uv + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + prune-cache: true + - name: Get test environments + id: get-envs + run: | + ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries + | map( + select(.key | startswith("hatch-test")) + | { + name: .key, + label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end), + python: .value.python + } + )') + echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT - test: - needs: get-environments - permissions: - id-token: write # for codecov OIDC - contents: read + test: + needs: get-environments + permissions: + id-token: write # for codecov OIDC + contents: read - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - env: ${{ fromJSON(needs.get-environments.outputs.envs) }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + env: ${{ fromJSON(needs.get-environments.outputs.envs) }} - name: ${{ matrix.env.label }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - continue-on-error: ${{ contains(matrix.env.name, 'pre') }} # make "all-green" pass even if pre-release job fails - env: - UV_PYTHON: ${{ matrix.env.python }} + name: ${{ matrix.env.label }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + continue-on-error: ${{ contains(matrix.env.name, 'pre') }} # make "all-green" pass even if pre-release job fails + env: + UV_PYTHON: ${{ matrix.env.python }} - steps: - - *clone - - *setup-uv - - name: create hatch environment - run: uvx hatch env create ${{ matrix.env.name }} - - name: list all all installed package versions - run: uvx hatch run ${{ matrix.env.name }}:uv pip list - - name: run tests using hatch - env: - MPLBACKEND: agg - PLATFORM: ${{ matrix.os }} - DISPLAY: :42 - run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto --dist worksteal --run-network - - name: generate coverage report - run: | - # See https://coverage.readthedocs.io/page/config.html#run-patch - test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine - uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly - uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload - - name: Upload coverage - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 - with: - fail_ci_if_error: true - use_oidc: true + steps: + - *clone + - *setup-uv + - name: create hatch environment + run: uvx hatch env create ${{ matrix.env.name }} + - name: list all all installed package versions + run: uvx hatch run ${{ matrix.env.name }}:uv pip list + - name: run tests using hatch + env: + MPLBACKEND: agg + PLATFORM: ${{ matrix.os }} + DISPLAY: :42 + run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto --dist worksteal --run-network + - name: generate coverage report + run: | + # See https://coverage.readthedocs.io/page/config.html#run-patch + test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine + uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly + uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload + - name: Upload coverage + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 + with: + fail_ci_if_error: true + use_oidc: true - # One required check for branch protection, so it does not need updating whenever the matrix changes. - check: - name: Tests pass in all hatch environments - if: always() - needs: - - get-environments - - test - runs-on: ubuntu-latest - steps: - - uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0 - with: - jobs: ${{ toJSON(needs) }} + # One required check for branch protection, so it does not need updating whenever the matrix changes. + check: + name: Tests pass in all hatch environments + if: always() + needs: + - get-environments + - test + runs-on: ubuntu-latest + steps: + - uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d584d9479..4ac191208 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,64 +1,64 @@ fail_fast: false default_language_version: - python: python3 + python: python3 default_stages: - - pre-commit - - pre-push + - pre-commit + - pre-push minimum_pre_commit_version: 2.16.0 repos: - - repo: https://github.com/biomejs/pre-commit - rev: v2.6.4 - hooks: - - id: biome-format - exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually. - groups: [format] - # further file exclusions and other options are configured in biome.jsonc - - repo: https://github.com/jolars/panache-pre-commit - rev: v3.18.0 - hooks: - - id: panache-format - groups: [format] - - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.30.3 - hooks: - - id: pyproject-fmt - groups: [format] - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.17.3 - hooks: - - id: ruff-check - args: [--fix, --exit-non-zero-on-fix] - - id: ruff-format - groups: [format] - - repo: local - hooks: - - id: mypy - name: mypy - entry: hatch check types - language: system - types: [python] - files: ^(src|tests)/ - require_serial: true - pass_filenames: false - groups: [typecheck] - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: detect-private-key - - id: end-of-file-fixer - groups: [format] - - id: mixed-line-ending - args: [--fix=lf] - groups: [format] - - id: trailing-whitespace - groups: [format] - - id: check-case-conflict - # Check that there are no merge conflicts (could be generated by template sync) - - id: check-merge-conflict - args: [--assume-in-merge] + - repo: https://github.com/biomejs/pre-commit + rev: v2.6.6 + hooks: + - id: biome-format + exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually. + groups: [format] + # further file exclusions and other options are configured in biome.jsonc + - repo: https://github.com/jolars/panache-pre-commit + rev: v3.18.0 + hooks: + - id: panache-format + groups: [format] + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.30.6 + hooks: + - id: pyproject-fmt + groups: [format] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.17.4 + hooks: + - id: ruff-check + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + groups: [format] + - repo: local + hooks: + - id: mypy + name: mypy + entry: hatch check types + language: system + types: [python] + files: ^(src|tests)/ + require_serial: true + pass_filenames: false + groups: [typecheck] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: detect-private-key + - id: end-of-file-fixer + groups: [format] + - id: mixed-line-ending + args: [--fix=lf] + groups: [format] + - id: trailing-whitespace + groups: [format] + - id: check-case-conflict + # Check that there are no merge conflicts (could be generated by template sync) + - id: check-merge-conflict + args: [--assume-in-merge] - - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.32.0 - hooks: - - id: zizmor - args: [--no-progress, --fix] + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.32.0 + hooks: + - id: zizmor + args: [--no-progress, --fix] diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 35d59e2a9..ea75699d8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,22 +1,22 @@ # https://docs.readthedocs.io/page/config-file/v2.html version: 2 build: - os: ubuntu-24.04 - tools: - python: "3.14" - jobs: - post_checkout: - # unshallow so the version can be derived from the git tag - - git fetch --unshallow || true - create_environment: - - asdf plugin add uv - - asdf install uv latest - - asdf global uv latest - build: - html: - - uvx hatch run docs:build - - mv docs/_build $READTHEDOCS_OUTPUT + os: ubuntu-24.04 + tools: + python: "3.14" + jobs: + post_checkout: + # unshallow so the version can be derived from the git tag + - git fetch --unshallow || true + create_environment: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + build: + html: + - uvx hatch run docs:build + - mv docs/_build $READTHEDOCS_OUTPUT submodules: - include: - - "docs/tutorials/notebooks" - recursive: true + include: + - "docs/tutorials/notebooks" + recursive: true diff --git a/biome.jsonc b/biome.jsonc index 9810c7a0b..dad854d3a 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.6/schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, "formatter": { "useEditorconfig": true }, "markdown": { "formatter": { "enabled": false } }, // handled by panache diff --git a/src/spatialdata/datasets.yaml b/src/spatialdata/datasets.yaml index 62e151d45..fd057e978 100644 --- a/src/spatialdata/datasets.yaml +++ b/src/spatialdata/datasets.yaml @@ -11,17 +11,17 @@ # a ``license_url`` field. base_url: https://exampledata.scverse.org/spatialdata/ datasets: - cells: - type: spatialdata - doc_header: Cells dataset as a SpatialData object. - license: CC BY 4.0 - license_url: https://creativecommons.org/licenses/by/4.0/ - attribution: >- - Derived from the 10x Genomics Xenium Prime Cervical Cancer FFPE dataset - (https://www.10xgenomics.com/datasets/xenium-prime-ffpe-human-cervical-cancer), - subset to a small tissue region. Licensed under CC BY 4.0 - (https://creativecommons.org/licenses/by/4.0/). - files: - - name: cells.zip - s3_key: cells.zip - sha256: dc9613cb9e16fd2cd8d83f3a9586eeda4af5ba8ba366f1066efb51305820c5fb + cells: + type: spatialdata + doc_header: Cells dataset as a SpatialData object. + license: CC BY 4.0 + license_url: https://creativecommons.org/licenses/by/4.0/ + attribution: >- + Derived from the 10x Genomics Xenium Prime Cervical Cancer FFPE dataset + (https://www.10xgenomics.com/datasets/xenium-prime-ffpe-human-cervical-cancer), + subset to a small tissue region. Licensed under CC BY 4.0 + (https://creativecommons.org/licenses/by/4.0/). + files: + - name: cells.zip + s3_key: cells.zip + sha256: dc9613cb9e16fd2cd8d83f3a9586eeda4af5ba8ba366f1066efb51305820c5fb diff --git a/tests/io/test_readwrite.py b/tests/io/test_readwrite.py index c21d7a0d3..3875f4da8 100644 --- a/tests/io/test_readwrite.py +++ b/tests/io/test_readwrite.py @@ -474,7 +474,7 @@ def test_incremental_io_on_disk( new_name=new_name, sdata_container_format=sdata_container_format, ) - elif workaround == 2: + elif workaround == 2: # noqa: SIM102 # workaround 2, unsafe but sometimes acceptable depending on the user's workflow. # this works only if the data is not dask-backed, otherwise an exception will be raised because the code