Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/phantoms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: ["3.10"]
python: ["3.12"]
fail-fast: false

steps:
Expand Down Expand Up @@ -87,16 +87,19 @@ jobs:
cache-dependency-path: |
pypet2bids/pyproject.toml
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh && echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Install Python Dependencies
run: |
cd pypet2bids
pip install .
pip install -e .[dev]
- name: Install Poetry Build Package
- name: Install UV Build Package
run: |
make installpoetry
make installuv
make buildpackage
make installpackage
cd pypet2bids && uv pip install dist/pypet2bids-*.whl --system
dcm2niix4pet -h
- name: Set Up Node
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
os: [macOS-latest, ubuntu-latest]
python: ['3.9', '3.10']
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout Repo
Expand All @@ -47,14 +47,16 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: 'pypet2bids/pyproject.toml'

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh && echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd pypet2bids
python -m pip install --upgrade pip
pip install poetry==1.6.1
poetry install --with dev
pip install -e .[dev]
- name: Collect ECAT and other phantoms
if: steps.cache-phantoms.outputs.cache-hit != 'true'
Expand All @@ -73,12 +75,12 @@ jobs:
- name: Test CLI --help
run: |
cd pypet2bids/
poetry run python3 -m pypet2bids.ecat_cli --help
python3 -m pypet2bids.ecat_cli --help
- name: Test CLI Ecat Dump
run: |
cd pypet2bids/
poetry run python3 -m pypet2bids.ecat_cli ${{ env.REAL_ECAT_TEST_PATH }} --dump
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
Expand All @@ -87,9 +89,9 @@ jobs:
gzip -d ${{ env.SMALLER_ECAT_PATH }}
- name: Test ecatread
run: "cd pypet2bids/ && poetry run python3 -m tests.test_ecatread"
run: "cd pypet2bids/ && python3 -m tests.test_ecatread"

- name: Run All Other Python Tests w/ Pytest
run: |
cd pypet2bids
poetry run pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/
python -m pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/
28 changes: 16 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ help:
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# add a dependency, this is an alias for poetry add that also updates the requirements.txt file
# add a dependency, this is an alias for uv add that also updates the pyproject.toml file
add:
@scripts/add_python_dependency $(ARGUMENTS)

# copies metadata to path included in pypet2bids project to enable packaging of those files w/ poetry
# builds package using standard Python packaging tools
buildpackage:
@cp pypet2bids/pyproject.toml pypet2bids/pypet2bids/pyproject.toml
@rm -rf pypet2bids/dist
@cd pypet2bids && poetry lock && poetry build
@cd pypet2bids && uv build

publish:
@cd pypet2bids && poetry publish
@cd pypet2bids && uv publish

installpoetry:
@cd scripts && ./installpoetry
installuv:
@cd scripts && ./installuv

# installs latest package
installpackage:
Expand All @@ -43,14 +43,18 @@ installpackage:
testphantoms:
@scripts/testphantoms

# test package across all supported Python versions
test-all-python-versions:
@scripts/test_all_python_versions

html:
@cd docs && make html

installdependencies:
@cd pypet2bids; \
python -m pip install --upgrade pip; \
pip install poetry; \
poetry install --with dev
pip install uv; \
uv sync --dev

collectphantoms:
ifeq (, $(wildcard ./PHANTOMS.zip))
Expand All @@ -64,20 +68,20 @@ decompressphantoms:

testecatcli:
@cd pypet2bids; \
poetry run python -m pypet2bids.ecat_cli --help; \
poetry run python -m pypet2bids.ecat_cli ../OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.v --dump
uv run python -m pypet2bids.ecat_cli --help; \
uv run python -m pypet2bids.ecat_cli ../OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.v --dump

testecatread:
@cd pypet2bids; \
export TEST_ECAT_PATH="../OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.v"; \
export READ_ECAT_SAVE_AS_MATLAB="$$PWD/tests/ECAT7_multiframe.mat"; \
export NIBABEL_READ_ECAT_SAVE_AS_MATLAB="$$PWD/tests/ECAT7_multiframe.nibabel.mat"; \
poetry run python3 -m tests.test_ecatread
uv run python3 -m tests.test_ecatread

testotherpython:
cd pypet2bids; \
export TEST_DICOM_IMAGE_FOLDER="../OpenNeuroPET-Phantoms/sourcedata/SiemensBiographPETMR-NIMH/AC_TOF"; \
poetry run pytest --ignore=tests/test_write_ecat.py tests/ -vvv
uv run pytest --ignore=tests/test_write_ecat.py tests/ -vvv

pythongithubworkflow: installdependencies collectphantoms decompressphantoms testecatread testecatcli testotherpython
@echo finished running python tests
Expand Down
Loading
Loading