Skip to content
Open
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
24 changes: 14 additions & 10 deletions .github/workflows/test_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ jobs:
- name: Set min. dependencies
if: matrix.requires == 'minimal'
run: |
python -c "req = open('requirements.txt').read().replace(' >= ', ' == ') ; open('requirements.txt', 'w').write(req)"
python -c "req = open('requirements_dev.txt').read().replace(' >= ', ' == ') ; open('requirements_dev.txt', 'w').write(req)"
python -c "req = open('setup.py').read().replace(' >= ', ' == ') ; open('setup.py', 'w').write(req)"
python -c "req = open('pyproject.toml').read().replace(' >= ', ' == ') ; open('pyproject.toml', 'w').write(req)"

# - name: Cache pip
# uses: actions/cache@v2
Expand All @@ -45,18 +43,24 @@ jobs:
- name: Install dependencies
# if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade --user pip setuptools pytest-cov
pip install -r requirements_dev.txt
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL required due to
# some dependency listing "scikit-learn" as "sklearn" in its dependencies
export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
python -m pip install --upgrade --user pip
pip install setuptools tox
pip install -e .[test]
python --version
pip --version
pip list

- name: Run tests
run: |
# tox --sitepackages
pip install -e .
# Test with tox
tox --sitepackages
# Test with pytest
python -c 'import whitematteranalysis'
coverage run --source whitematteranalysis -m pytest -o junit_family=xunit2 -v --doctest-modules --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
coverage run --source whitematteranalysis -m pytest -o junit_family=xunit2 -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
# coverage run --source whitematteranalysis -m pytest -o junit_family=xunit2 -v --doctest-modules --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml

- name: Upload pytest test results
uses: actions/upload-artifact@master
Expand All @@ -74,9 +78,9 @@ jobs:
- name: Package Setup
# - name: Run tests with tox
run: |
# pip install build
pip install build
# check-manifest
python setup.py install
python -m build
# twine check dist/
# tox --sitepackages
# python -m tox
2 changes: 1 addition & 1 deletion bin/tests/test_harden_transform_with_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["harden_transform_with_slicer.py", "--help"])
ret = script_runner.run(["bin/harden_transform_with_slicer.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_append_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_append_clusters.py", "--help"])
ret = script_runner.run(["bin/wm_append_clusters.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_append_clusters_to_anatomical_tracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

def test_help_option(script_runner):
ret = script_runner.run(
["wm_append_clusters_to_anatomical_tracts.py", "--help"])
["bin/wm_append_clusters_to_anatomical_tracts.py", "--help"])
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

def test_help_option(script_runner):
ret = script_runner.run(
["wm_append_diffusion_measures_across_subjects.py", "--help"])
["bin/wm_append_diffusion_measures_across_subjects.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_assess_cluster_location_by_hemisphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

def test_help_option(script_runner):
ret = script_runner.run(
["wm_assess_cluster_location_by_hemisphere.py", "--help"])
["bin/wm_assess_cluster_location_by_hemisphere.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_average_tract_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_average_tract_measures.py", "--help"])
ret = script_runner.run(["bin/wm_average_tract_measures.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_change_nrrd_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_change_nrrd_dir.py", "--help"])
ret = script_runner.run(["bin/wm_change_nrrd_dir.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_cluster_from_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_cluster_from_atlas.py", "--help"])
ret = script_runner.run(["bin/wm_cluster_from_atlas.py", "--help"])
assert ret.success


Expand Down
2 changes: 1 addition & 1 deletion bin/tests/test_wm_cluster_remove_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_cluster_remove_outliers.py", "--help"])
ret = script_runner.run(["bin/wm_cluster_remove_outliers.py", "--help"])
assert ret.success


Expand Down
3 changes: 2 additions & 1 deletion bin/tests/test_wm_cluster_volumetric_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_cluster_volumetric_measurements.py", "--help"])
ret = script_runner.run(
["bin/wm_cluster_volumetric_measurements.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_compare_vtks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_compare_vtks.py", "--help"])
ret = script_runner.run(["bin/wm_compare_vtks.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_create_mrml_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_create_mrml_file.py", "--help"])
ret = script_runner.run(["bin/wm_create_mrml_file.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_diffusion_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_diffusion_measurements.py", "--help"])
ret = script_runner.run(["bin/wm_diffusion_measurements.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_download_anatomically_curated_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

def test_help_option(script_runner):
ret = script_runner.run(
["wm_download_anatomically_curated_atlas.py", "--help"])
["bin/wm_download_anatomically_curated_atlas.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_harden_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_harden_transform.py", "--help"])
ret = script_runner.run(["bin/wm_harden_transform.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_preprocess_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_preprocess_all.py", "--help"])
ret = script_runner.run(["bin/wm_preprocess_all.py", "--help"])
assert ret.success
3 changes: 2 additions & 1 deletion bin/tests/test_wm_quality_control_after_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_quality_control_after_clustering.py", "--help"])
ret = script_runner.run(
["bin/wm_quality_control_after_clustering.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_quality_control_cluster_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

def test_help_option(script_runner):
ret = script_runner.run(
["wm_quality_control_cluster_measurements.py", "--help"])
["bin/wm_quality_control_cluster_measurements.py", "--help"])
assert ret.success
3 changes: 2 additions & 1 deletion bin/tests/test_wm_quality_control_tract_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_quality_control_tract_overlap.py", "--help"])
ret = script_runner.run(
["bin/wm_quality_control_tract_overlap.py", "--help"])
assert ret.success
3 changes: 2 additions & 1 deletion bin/tests/test_wm_quality_control_tractography.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@


def test_help_option(script_runner):
ret = script_runner.run(["wm_quality_control_tractography.py", "--help"])
ret = script_runner.run(
["bin/wm_quality_control_tractography.py", "--help"])
assert ret.success


Expand Down
3 changes: 2 additions & 1 deletion bin/tests/test_wm_register_multisubject_faster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_register_multisubject_faster.py", "--help"])
ret = script_runner.run(
["bin/wm_register_multisubject_faster.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_register_to_atlas_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_register_to_atlas_new.py", "--help"])
ret = script_runner.run(["bin/wm_register_to_atlas_new.py", "--help"])
assert ret.success


Expand Down
2 changes: 1 addition & 1 deletion bin/tests/test_wm_remove_data_along_tracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_remove_data_along_tracts.py", "--help"])
ret = script_runner.run(["bin/wm_remove_data_along_tracts.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_separate_clusters_by_hemisphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_separate_clusters_by_hemisphere.py", "--help"])
ret = script_runner.run(["bin/wm_separate_clusters_by_hemisphere.py", "--help"])
assert ret.success


Expand Down
2 changes: 1 addition & 1 deletion bin/tests/test_wm_tract_to_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_tract_to_volume.py", "--help"])
ret = script_runner.run(["bin/wm_tract_to_volume.py", "--help"])
assert ret.success
2 changes: 1 addition & 1 deletion bin/tests/test_wm_vtp2vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run(["wm_vtp2vtk.py", "--help"])
ret = script_runner.run(["bin/wm_vtp2vtk.py", "--help"])
assert ret.success
41 changes: 9 additions & 32 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,30 @@
import os
import re
from datetime import datetime
from importlib.metadata import version as vers

import tomli

# import sys

# sys.path.insert(0, os.path.abspath('.'))

author_setup_str = " author="
author_email_setup_str = " author_email="
name_setup_str = " name="
version_setup_str = " version="


# Load the release info into a dict by explicit execution
info = {}
with open(os.path.abspath(os.path.join(
os.path.dirname(__file__), "../..", "setup.py")), "r") as f:
for line in f:
if line.startswith(name_setup_str):
project = (
re.search(name_setup_str + "(.*),", line).group(1).strip("\'"))
elif line.startswith(author_setup_str):
_author = (
re.search(
author_setup_str + "(.*),",
line).group(1).strip("\'").replace("\\", "")
)
elif line.startswith(author_email_setup_str):
_email = (
re.search(
author_email_setup_str + "(.*),",
line).group(1).strip("\'")
)
elif line.startswith(version_setup_str):
_version = (
re.search(
version_setup_str + "(.*),",
line).group(1).strip("\'")
)
with open(os.path.join("../..", "pyproject.toml"), "rb") as f:
info = tomli.load(f)

# -- Project information -----------------------------------------------------

project = info["project"]["name"]
_author = info["project"]["authors"][0]["name"]
_email = info["project"]["authors"][1]["email"]
copyright = f"2013-{datetime.now().year}, {_author} <{_email}>"
author = f"{_author}s"

_version = vers(project)
# The full version, including alpha/beta/rc tags
release = _version


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down
Loading