Unverified Commit 53fc4d13 authored by Zhang, Chen's avatar Zhang, Chen Committed by GitHub
Browse files

Numpy 2.x compatible and switch to Pixi (#326)



* update to np 2.x and switch to pixi

* add pixi lock file

* update pixi for Github actions

* remove outdated action branch

* Update tests/unit/backend/dataio/test_data.py

Co-authored-by: default avatarCopilot <175728472+Copilot@users.noreply.github.com>

* Update tests/unit/backend/dataio/test_data.py

Co-authored-by: default avatarCopilot <175728472+Copilot@users.noreply.github.com>

* Update GitHub Actions workflow to run tests with xvfb and change rotation angle dtype to float64

* fix tomopy upstream issue via duck typing

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

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



* disable lint check to allow duck type patching

---------

Co-authored-by: default avatarCopilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: default avatarpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
parent f0329db4
Loading
Loading
Loading
Loading
+9 −27
Original line number Diff line number Diff line
@@ -15,36 +15,18 @@ jobs:
        shell: bash -l {0}
    steps:
      - uses: actions/checkout@v4
      - uses: conda-incubator/setup-miniconda@v3
      - uses: prefix-dev/setup-pixi@v0.8.2
        with:
          auto-update-conda: true
          mamba-version: "*"
          environment-file: environment.yml
          pixi-version: v0.50.2
          manifest: pyproject.toml
      - name: Verify docstrings
        run: pydocstyle --convention=numpy src/
        run: pixi run pydocstyle --convention=numpy src/
      - name: Install ui test requirements
        run: playwright install
      - name: Install iMars3d in editable mode
        run: pip install -e .
        run: pixi run playwright install
      - name: Tests without data repository
        uses: coactions/setup-xvfb@v1
        with:
          run: |
          python -m pytest --cov --cov-report=xml --cov-report=term -m "not datarepo"
            pixi run pytest -m 'not datarepo' --tb=short -v
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v5

  build-wheel:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash -l {0}
    steps:
      - uses: actions/checkout@v4
      - uses: conda-incubator/setup-miniconda@v3
        with:
          auto-update-conda: true
          mamba-version: "*"
          environment-file: environment.yml
      - name: Build Wheel
        run: python -m build --no-isolation --wheel
      - name: Check Wheel Contents
        run: check-wheel-contents .
+10 −45
Original line number Diff line number Diff line
@@ -27,13 +27,12 @@ jobs:
        with:
          submodules: true
          lfs: true
      - uses: conda-incubator/setup-miniconda@v3
      - uses: prefix-dev/setup-pixi@v0.8.2
        with:
          auto-update-conda: true
          miniforge-version: latest
          environment-file: environment.yml
          pixi-version: v0.50.2
          manifest: pyproject.toml
      - name: Tests with data repository
        run: python -m pytest -m datarepo
        run: pixi run pytest -m datarepo
      - name: Update job status
        uses: Sibz/github-status-action@v1
        if: ${{ always() && github.event_name == 'workflow_dispatch' }}
@@ -53,17 +52,14 @@ jobs:
        shell: bash -l {0}
    steps:
      - uses: actions/checkout@v4
      - uses: conda-incubator/setup-miniconda@v3
      - uses: prefix-dev/setup-pixi@v0.8.2
        with:
          auto-update-conda: true
          mamba-version: "*"
          environment-file: environment.yml
          pixi-version: v0.50.2
          manifest: pyproject.toml
      - name: Build Conda Package
        run: |
          # boa uses mamba to resolve dependencies
          cd conda.recipe
          VERSION=$(versioningit ../) conda mambabuild --output-folder . -c conda-forge . || exit 1
          conda verify noarch/imars3d*.tar.bz2 || exit 1
          # Build conda package using pixi
          pixi run conda-build
      - name: Deploy to Anaconda
        shell: bash -l {0}
        if: startsWith(github.ref, 'refs/tags/v')
@@ -75,35 +71,4 @@ jobs:
          CONDA_LABEL="main"
          if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
          echo pushing ${{ github.ref }} with label $CONDA_LABEL
          anaconda upload --label $CONDA_LABEL conda.recipe/noarch/imars3d*.tar.bz2


  trigger-deploy:
    runs-on: ubuntu-22.04
    needs: [build-conda]
    # only trigger deploys from protected branches
    if: ${{ github.ref_protected || github.ref_type == 'tag' }}
    steps:
      - name: Determine Environment
        uses: neutrons/branch-mapper@v2
        id: conda_env_name
        with:
          prefix: imars3d

      - name: Trigger deploy
        id: trigger
        uses: eic/trigger-gitlab-ci@v3
        with:
          url: https://code.ornl.gov
          token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
          project_id: 11848
          ref_name: main
          variables: |
            PLAY="update"
            CONDA_ENV="${{ steps.conda_env_name.outputs.name }}"

      - name: Annotate commit
        uses: peter-evans/commit-comment@v3
        with:
          body: |
            GitLab pipeline for ${{ steps.conda_env_name.outputs.name }} has been submitted for this commit: ${{ steps.trigger.outputs.web_url }}
          pixi run anaconda upload --label $CONDA_LABEL *.conda
+12 −0
Original line number Diff line number Diff line
@@ -277,3 +277,15 @@ $RECYCLE.BIN/
# End of https://www.toptal.com/developers/gitignore/api/python,macos,linux,windows,visualstudiocode
.vscode/settings.json
_version.py

# Pixi
.pixi/
pixi.lock
*.conda
pyproject.toml.bak

# node modules
node_modules/
package-lock.json
package.json
.claude/settings.local.json
+8 −7
Original line number Diff line number Diff line
@@ -33,12 +33,13 @@ repos:
    rev: v1.37.1
    hooks:
      - id: yamllint
    name: yamllint
    description: This hook runs yamllint.
    entry: yamllint
    language: python
    types: [file, yaml]
  - repo: https://github.com/kynan/nbstripout
    rev: 0.8.1
    hooks:
      - id: nbstripout
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.9.2
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format
+2 −1
Original line number Diff line number Diff line
@@ -4,8 +4,9 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
import versioningit

import param
import versioningit

param.parameterized.docstring_signature = False
param.parameterized.docstring_describe_params = False
Loading