Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3f1f5d2
Adding testing to the CI.
christian-oreilly Dec 11, 2024
1735f74
Adding the pip install for pre-commit
christian-oreilly Dec 11, 2024
c829036
Remove test duplication
christian-oreilly Dec 11, 2024
7dff7a4
Testing across os.
christian-oreilly Dec 11, 2024
cb81c0a
Applying nb-clean clean --remove-empty-cells before commit to fix the…
christian-oreilly Jan 15, 2025
860d6a8
Removing support Python 3.8
christian-oreilly Jan 15, 2025
d9f2210
Change private modules to public as per #109
christian-oreilly Jan 29, 2025
8cb18cc
Updating options_mixing to the refactoring for #109
christian-oreilly Jan 29, 2025
3802bba
Updating options_mixing to the refactoring for #109
christian-oreilly Jan 29, 2025
6706fcf
Updating options_mixing to the refactoring for #109
christian-oreilly Jan 29, 2025
8553557
Linting
christian-oreilly Jan 29, 2025
66ffa7d
Adding summary documentation where it was missing.
christian-oreilly Jan 29, 2025
eac2d4a
Update CI.
christian-oreilly Jan 29, 2025
d817a82
Update ci.yml
christian-oreilly Jan 29, 2025
2905274
Update ci.yml
christian-oreilly Jan 29, 2025
5383b2f
codespell
christian-oreilly Jan 29, 2025
e549adb
Update ci.yml
christian-oreilly Jan 29, 2025
7a66d7e
Update ci.yml
christian-oreilly Jan 29, 2025
88a94cf
Update ci.yml - Test notebooks
christian-oreilly Jan 29, 2025
b9c377a
Update ci.yml
christian-oreilly Jan 29, 2025
b8a0e12
Update ci.yml
christian-oreilly Jan 29, 2025
893b86e
Fixing two broken notebooks caught by the CI
christian-oreilly Jan 29, 2025
1770db4
try pytest-cov intead
hanayik Jan 30, 2025
a21a2db
fix artifact naming
hanayik Jan 30, 2025
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
83 changes: 78 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: |
# Run Ruff
- name: Run Ruff
run: |
pip install uv
uv pip install --system ruff
ruff check
# Run Codespell
- name: Run Codespell
run: |
pip install codespell
codespell codespell src/**/*.py

Test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os:
- ubuntu-latest
- macos-latest # arm64 (Apple Silicon)
- macos-13 # latest Intel release
- windows-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -37,9 +49,70 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- run: |
pipx install hatch
hatch run test

pip install pytest-notebook
pip install pre-commit
pre-commit run --all
pre-commit install
# pipx install hatch
# hatch run test --cover --nb-test-files
- name: Install IPyNiiVue & Deps
run: pip install -e .
- name: Test import
run: |
python -c "import ipyniivue"
- name: Test IPyNiiVue
run: |
pip install pytest-cov
pip install --upgrade pip ipython ipykernel
ipython kernel install --name "python3" --user
mkdir -p ./reports
pytest --cov --cov-report=json:./reports/coverage.json --cov-report=xml:./reports/coverage.xml
- name: Upload ipyniivue test coverage report
uses: actions/upload-artifact@v4
with:
name: coverage_ipyniivue-${{ matrix.os }}-py${{ matrix.python-version }}
path: ./reports/coverage.json
- name: Generate Markdown summary of code coverage
uses: irongut/[email protected]
with:
filename: ./reports/coverage.xml
format: markdown
output: both
thresholds: "10 10"
- name: Add test results to job summary
run: |
cat ./code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Test example notebooks
run: |
pip install nbmake
rm -rf ./reports
mkdir -p ./reports
pytest --nbmake examples/*ipynb --cov --cov-report=json:./reports/coverage.json --cov-report=xml:./reports/coverage.xml
- name: Upload ipyniivue example notbooks coverage report
uses: actions/upload-artifact@v4
with:
name: coverage_ipyniivue_notebooks-${{ matrix.os }}-py${{ matrix.python-version }}
path: ./reports/coverage.json
- name: Generate Markdown summary of code coverage
uses: irongut/[email protected]
with:
filename: ./reports/coverage.xml
format: markdown
output: both
thresholds: "10 10"
- name: Add test results to job summary
run: |
cat ./code-coverage-results.md >> $GITHUB_STEP_SUMMARY
# coverage run -m pytest --nb-test-files
# nbt-test-files check for changes in the output of the notebook.
# This does not work for our purpose since we wipe the output
# before committing changes to facilitate integration with git.
# - name: Upload coverage to codecov (Only do this for the ubuntu-latest job)
# if: matrix.os == 'ubuntu-latest'
# uses: codecov/codecov-action@v5
# with:
# token: ${{secrets.CODECOV_TOKEN}}
#
LintJavaScript:
name: JavaScript / Lint
runs-on: macos-14
Expand Down
3 changes: 1 addition & 2 deletions examples/additive_voxels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
10 changes: 1 addition & 9 deletions examples/basic_multiplanar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@
"nv.is_colorbar = True\n",
"nv.view_mode_hot_key = \"KeyN\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -102,8 +95,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
11 changes: 1 addition & 10 deletions examples/drawing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@
"for widget in widgetArray:\n",
" display(widget[\"widget\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32e9b296-bae2-47c4-9912-e99e5cb6a85e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -134,8 +126,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
22 changes: 12 additions & 10 deletions examples/example_sideview.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "52de1125",
"metadata": {},
"outputs": [],
"source": [
"# This is not part of IPyNiiVue dependencies so it has to be installed independently\n",
"!pip install ipylab"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -81,14 +92,6 @@
"nv.volumes[0].opacity = 0.5\n",
"nv.volumes[1].colormap = \"green\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c7b34b44-2940-4f0e-99b5-2e16ad3d23f3",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -106,8 +109,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
11 changes: 1 addition & 10 deletions examples/mesh_and_volume.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@
"\n",
"nv"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "851a559d-59e8-40bc-b1f0-9380f9844855",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -88,8 +80,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions examples/mesh_layers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"pygments_lexer": "ipython3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@
"\n",
"# nv1.setMeshShader(nv1.meshes[0].id, \"Outline\"); does not seem to exist yet."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -77,8 +70,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
11 changes: 1 addition & 10 deletions examples/prototypes/torso_regions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@
"}\n",
"nv.setDrawColormap(cmap);"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94a1c95a-308b-4259-ac29-7512c48239b2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -108,8 +100,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
10 changes: 1 addition & 9 deletions examples/prototypes/trajectory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@
"\n",
"nv"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -85,8 +78,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
21 changes: 6 additions & 15 deletions examples/widgets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
" value=3,\n",
" description=\"Slice Type:\",\n",
" ),\n",
" \"object\": nv,\n",
" \"obj\": nv,\n",
" \"attribute\": \"slice_type\",\n",
"}\n",
"widgetArray.append(widget_slice_type)\n",
Expand All @@ -85,7 +85,7 @@
" description=\"Scan Opacity:\",\n",
" orientation=\"horizontal\",\n",
" ),\n",
" \"object\": nv.volumes[0],\n",
" \"obj\": nv.volumes[0],\n",
" \"attribute\": \"opacity\",\n",
"}\n",
"widgetArray.append(widget_scan_opacity)\n",
Expand All @@ -99,7 +99,7 @@
" description=\"Hippocampus Opacity:\",\n",
" orientation=\"horizontal\",\n",
" ),\n",
" \"object\": nv.volumes[1],\n",
" \"obj\": nv.volumes[1],\n",
" \"attribute\": \"opacity\",\n",
"}\n",
"widgetArray.append(widget_hippo_opacity)\n",
Expand All @@ -110,7 +110,7 @@
" value=\"Gray\",\n",
" description=\"Scan Colormap:\",\n",
" ),\n",
" \"object\": nv.volumes[0],\n",
" \"obj\": nv.volumes[0],\n",
" \"attribute\": \"colormap\",\n",
"}\n",
"widgetArray.append(widget_scan_colormap)\n",
Expand All @@ -121,7 +121,7 @@
" value=\"Red\",\n",
" description=\"Hippocampus Colormap:\",\n",
" ),\n",
" \"object\": nv.volumes[1],\n",
" \"obj\": nv.volumes[1],\n",
" \"attribute\": \"colormap\",\n",
"}\n",
"widgetArray.append(widget_hippo_colormap)\n",
Expand Down Expand Up @@ -150,14 +150,6 @@
"for widget in widgetArray:\n",
" display(widget[\"widget\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4c94695d-b936-472e-a4f1-7dc216833388",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -175,8 +167,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading