Skip to content

Commit

Permalink
Merge pull request Open-Minds-Lab#56 from sinhaharsh/master
Browse files Browse the repository at this point in the history
Integration to MRdataset 2.0
  • Loading branch information
raamana authored Nov 30, 2023
2 parents c140927 + b60cad4 commit e6db9ac
Show file tree
Hide file tree
Showing 68 changed files with 8,675 additions and 2,009 deletions.
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[run]
branch = True
omit = */tests/*
_*.py
plotting.py

[report]
; Regexes for lines to exclude from consideration
exclude_also =
; Don't complain about missing debug-only code:
def __repr__
if self\.debug

; Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

; Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

; Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod

ignore_errors = True

[html]
directory = htmlcov
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ insert_final_newline = false

[Makefile]
indent_style = tab

[*.py]
max_line_length = 80
2 changes: 1 addition & 1 deletion .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: tests

on:
push:
branches:
- master

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8" ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/sinhaharsh/protocol.git#egg=protocol
pip install git+https://github.com/sinhaharsh/MRdataset.git#egg=MRdataset
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
pip install .
- name: Lint with flake8
run: |
make lint
# stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
# - name: Coverage
# run: |
# coverage run --rcfile=.coveragerc --source mrQA -m pytest
# coverage report -m
# coverage xml
# - name: Run codacy-coverage-reporter
# uses: codacy/codacy-coverage-reporter-action@v1
# with:
# # project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# # or
# api-token: ${{ secrets.CODACY_API_TOKEN }}
# organization-provider: gh
# username: sinhaharsh
# project-name: mrQA
# coverage-reports: coverage.xml
# # or a comma-separated list for multiple reports
# # coverage-reports: <PATH_TO_REPORT>, <PATH_TO_REPORT>
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,10 @@ ENV/
.vscode/
.idea/
/update_today.txt

# codacy
*.sarif

# mri protocol
*.xml
*.secrets
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ include HISTORY.rst
include LICENSE
include README.rst

recursive-include tests *
graft mrQA/tests
prune mrQA/tests/htmlcov
prune mrQA/tests/.hypothesis
graft mrQA/scripts
graft mrQA/resources
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

Expand Down
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache

lint/flake8: ## check style with flake8
flake8 mrQA tests
flake8 mrQA

lint: lint/flake8 ## check style

Expand All @@ -59,18 +59,19 @@ test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
coverage run --source mrQA -m pytest
coverage run --rcfile=.coveragerc --source mrQA -m pytest
coverage report -m
coverage html
coverage xml
$(BROWSER) htmlcov/index.html

act:
act --secret-file .secrets

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/mrQA.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ mrQA
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
$(BROWSER) docs/build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
Expand All @@ -85,3 +86,11 @@ dist: clean ## builds source and wheel package

install: clean ## install the package to the active Python's site-packages
python setup.py install

merge:
git switch mrds-issue-12
git push
git switch master
git merge mrds-issue-12
git push origin master
git switch mrds-issue-12
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ mrQA : automatic protocol compliance checks on MR datasets
.. image:: https://img.shields.io/pypi/v/mrQA.svg
:target: https://pypi.python.org/pypi/mrQA

.. image:: https://img.shields.io/travis/Open-Minds-Lab/mrQA.svg
:target: https://travis-ci.com/Open-Minds-Lab/mrQA
.. image:: https://app.codacy.com/project/badge/Grade/8cd263e1eaa0480d8fac50eba0094401
:target: https://app.codacy.com/gh/sinhaharsh/mrQA/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade

.. image:: https://github.com/sinhaharsh/mrQA/actions/workflows/continuous-integration.yml/badge.svg
:target: https://github.com/sinhaharsh/mrQA/actions/workflows/continuous-integration.yml


.. image:: https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg
:target: https://nbviewer.org/github/Open-Minds-Lab/mrQA/blob/master/examples/usage.ipynb
Expand Down
7 changes: 7 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Command Line
============

.. argparse::
:module: mrQA.cli
:func: get_parser
:prog: mrQA
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon']
'sphinx.ext.napoleon',
'sphinxarg.ext']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
12 changes: 10 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ CLI usage
A protocol compliance report can be generated directly from the command line
interface. The following is an example of generating a protocol compliance report

For a DICOM dataset::
For a DICOM dataset

.. code:: bash
mrqa --data-source /path/to/dataset --format dicom --name my_dataset
For a BIDS dataset::
For a BIDS dataset

.. code:: bash
mrqa --data-source /path/to/dataset --format bids --name my_dataset
.. toctree::
:maxdepth: 1

cli

API Tutorial
------------
Expand Down
Loading

0 comments on commit e6db9ac

Please sign in to comment.