switch to uv and update python supported versions #727
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: python | |
| on: | |
| push: | |
| pull_request: | |
| branches: | |
| - main | |
| - switch-phantoms-to-s3 | |
| workflow_call: | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
| required: false | |
| default: false | |
| jobs: | |
| Python-Collect-Data-and-Test: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| REAL_ECAT_TEST_PATH: ${{ github.workspace }}/OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.v | |
| SMALLER_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v.gz | |
| TEST_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v | |
| OUTPUT_NIFTI_PATH: ${{ github.workspace}}/pypet2bids/tests/ECAT7_multiframe.nii | |
| READ_ECAT_SAVE_AS_MATLAB: ${{ github.workspace }}/pypet2bids/tests/ECAT7_multiframe.mat | |
| NIBABEL_READ_ECAT_SAVE_AS_MATLAB: ${{ github.workspace }}/pypet2bids/tests/ECAT7_multiframe.nibabel.mat | |
| MATLAB_CODE_PATH: ${{ github.workspace }}/matlab/ | |
| strategy: | |
| matrix: | |
| os: [macOS-latest, ubuntu-latest] | |
| python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v2 | |
| - name: Cache Phantoms | |
| id: cache-phantoms | |
| uses: actions/cache@v4 | |
| with: | |
| path: US-sourced-OpenNeuroPET-Phantoms.zip | |
| key: ${{ runner.os }}-phantoms | |
| - name: Set up python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install UV | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Install dependencies | |
| run: | | |
| cd pypet2bids | |
| uv sync --dev | |
| - name: Collect ECAT and other phantoms | |
| if: steps.cache-phantoms.outputs.cache-hit != 'true' | |
| run: "wget https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip" | |
| - name: Decompress ECAT and other phantoms | |
| run: "unzip US-sourced-OpenNeuroPET-Phantoms.zip" | |
| - name: Debug | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
| timeout-minutes: 15 | |
| with: | |
| limit-access-to-actor: true | |
| - name: Test CLI --help | |
| run: | | |
| cd pypet2bids/ | |
| uv run python3 -m pypet2bids.ecat_cli --help | |
| - name: Test CLI Ecat Dump | |
| run: | | |
| cd pypet2bids/ | |
| uv run python3 -m pypet2bids.ecat_cli ${{ env.REAL_ECAT_TEST_PATH }} --dump | |
| # the larger real data file uses too much ram for the github runner, we use the small file for | |
| # heavy io operations instead | |
| - name: Unzip Test File(s) | |
| run: | | |
| gzip -d ${{ env.SMALLER_ECAT_PATH }} | |
| - name: Test ecatread | |
| run: "cd pypet2bids/ && uv run python3 -m tests.test_ecatread" | |
| - name: Run All Other Python Tests w/ Pytest | |
| run: | | |
| cd pypet2bids | |
| uv run pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/ |