forked from nipoppy/nipoppy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to match neurodatascience/nipoppy:main (#53)
- Loading branch information
Showing
87 changed files
with
11,449 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: ['*'] | ||
pull_request: | ||
branches: ['*'] | ||
|
||
# cancel previous runs if new one is triggered | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
# only trigger on upstream repo | ||
if: github.repository_owner == 'neurodatascience' && github.event.repository.name == 'nipoppy' | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install package | ||
run: | | ||
cd nipoppy_cli | ||
pip install -U pip | ||
pip install .[tests] | ||
- name: Run tests | ||
run: | | ||
python -m pytest nipoppy_cli --cov=nipoppy_cli/nipoppy --cov-report=xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
file: ./coverage.xml | ||
name: codecov-umbrella | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ htmlcov | |
|
||
|
||
env/ | ||
|
||
# VS Code | ||
.vscode/ |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 NeuroDataScience | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
![License](https://img.shields.io/badge/license-MIT-blue.svg) | ||
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8084759.svg)](https://doi.org/10.5281/zenodo.8084759) | ||
![https://github.com/psf/black](https://img.shields.io/badge/code%20style-black-000000.svg) | ||
|
||
# Nipoppy | ||
|
||
A framework for standardized organization and processing of neuroimaging-clinical datasets. | ||
|
||
## Developer setup | ||
|
||
Clone this repo: | ||
|
||
```bash | ||
git clone https://github.com/neurodatascience/nipoppy.git | ||
``` | ||
|
||
Install `nipoppy` in editable mode with `dev` dependencies: | ||
```bash | ||
cd nipoppy | ||
pip install -e .[dev] | ||
``` | ||
|
||
Set up `pre-commit`: | ||
```bash | ||
pre-commit install | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Nipoppy.""" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""Base class.""" | ||
|
||
import inspect | ||
from abc import ABC | ||
from typing import Optional, Sequence | ||
|
||
|
||
class Base(ABC): | ||
"""Base class with utilities for pretty string representations.""" | ||
|
||
def _str_helper( | ||
self, | ||
components: Optional[Sequence] = None, | ||
names: Optional[Sequence[str]] = None, | ||
sep=", ", | ||
) -> str: | ||
"""Generate a custom string representation of an object. | ||
The output string is of the form: ClassName(component1[sep]component2[sep]...) | ||
Parameters | ||
---------- | ||
components : Sequence, optional | ||
Components to concatenate, by default None | ||
names : Sequence[str], optional | ||
Name of attributes to be added to the components as key-value pairs, | ||
by default None | ||
sep : str, optional | ||
Separator between components, by default ", " | ||
Returns | ||
------- | ||
str | ||
String representation of the object. | ||
""" | ||
if components is None: | ||
components = [] | ||
|
||
if names is not None: | ||
for name in names: | ||
components.append(f"{name}={getattr(self, name)}") | ||
|
||
return f"{type(self).__name__}({sep.join([str(c) for c in components])})" | ||
|
||
def __str__(self) -> str: | ||
"""Return a string representation of the object based on its __init__ arguments. | ||
Raises | ||
------ | ||
RuntimeError | ||
If the parameter names obtained from the __init__ method do not match the | ||
attributes of the object. | ||
""" | ||
signature = inspect.signature(type(self)) | ||
names = [ | ||
name | ||
for name, parameter in signature.parameters.items() | ||
if parameter.kind is inspect.Parameter.POSITIONAL_OR_KEYWORD | ||
] | ||
try: | ||
return self._str_helper(names=names) | ||
except AttributeError: | ||
raise RuntimeError( | ||
f"The __init__ method of the {type(self)} class has positional and/or" | ||
" keyword arguments that are not set as attributes of the object" | ||
". Failed to build string representation: need to override the" | ||
" __str__ method" | ||
) | ||
|
||
def __repr__(self) -> str: | ||
return self.__str__() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Parsers and entrypoint for the command-line interface.""" |
Oops, something went wrong.