Skip to content

Commit

Permalink
Merge pull request #1087 from mnoergaard/martin
Browse files Browse the repository at this point in the history
[ENH] Update BEP009 with newest version of validator #1085
  • Loading branch information
melanieganz committed Oct 1, 2020
2 parents f7effef + f7d4077 commit a888d48
Show file tree
Hide file tree
Showing 90 changed files with 3,792 additions and 4,484 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/python_tests 2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Python tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: goanpeca/setup-miniconda@v1
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}

- name: Install git-annex ubuntu
if: matrix.platform == 'ubuntu-latest'
shell: bash -l {0}
run: conda install -c conda-forge git-annex

- name: Install git-annex macos
if: matrix.platform == 'macos-latest'
shell: bash -l {0}
run: brew install git-annex

- name: Install git-annex windows
if: matrix.platform == 'windows-latest'
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install git-annex --yes --ignore-checksums

- name: Install remaining dependencies
shell: bash -l {0}
run: |
which python
pip install datalad
pip install pytest pytest-sugar flake8 pydocstyle
pip install -e ./bids-validator
- name: Check formatting
shell: bash -l {0}
run: |
flake8 bids-validator/bids_validator
pydocstyle bids-validator/bids_validator/bids_validator.py
- name: Test with pytest
shell: bash -l {0}
run: |
pytest --doctest-modules bids-validator/bids_validator --verbose
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ffein@stanford.edu. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at krzysztof.gorgolewski@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

Expand Down
Empty file modified bids-validator-web/index.scss
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions bids-validator-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bids-validator-web",
"version": "1.5.5-dev.0",
"version": "1.4.0",
"description": "web client for bids-validator",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,9 +9,9 @@
"@zeit/next-sass": "^1.0.1",
"bootstrap": "^4.3.0",
"bowser": "^1.0.0",
"next": "^9.3.2",
"next": "^8.0.0",
"next-transpile-modules": "^2.3.1",
"node-sass": "4.13.1",
"node-sass": "^4.11.0",
"react": "^16.8.1",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^16.8.1"
Expand Down
Empty file modified bids-validator-web/pages/index.js
100644 → 100755
Empty file.
106 changes: 22 additions & 84 deletions bids-validator/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
[![CircleCI](https://circleci.com/gh/bids-standard/bids-validator.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/bids-standard/bids-validator)
[![Gitlab pipeline status](https://img.shields.io/gitlab/pipeline/bids-standard/bids-validator?logo=GitLab)](https://gitlab.com/bids-standard/bids-validator/pipelines)
[![Codecov](https://codecov.io/gh/bids-standard/bids-validator/branch/master/graph/badge.svg)](https://codecov.io/gh/bids-standard/bids-validator)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3688707.svg)](https://doi.org/10.5281/zenodo.3688707)

![](https://circleci.com/gh/bids-standard/bids-validator.svg?style=shield&circle-token=:circle-token)
![](https://codecov.io/gh/bids-standard/bids-validator/branch/master/graph/badge.svg)

# BIDS-Validator

* [BIDS-Validator](#bids-validator)
* [Quickstart](#quickstart)
* [Support](#support)
* [Maintainers and Contributors](#maintainers-and-contributors)
* [Use](#use)
* [API](#api)
* [.bidsignore](#bidsignore)
* [Configuration](#configuration)
* [In the Browser](#in-the-browser)
* [On the Server](#on-the-server)
* [Through Command Line](#through-command-line)
* [Docker image](#docker-image)
* [Python Library](#python-library)
* [Example](#example)
* [Development](#development)
* [Running Locally in a Browser](#running-locally-in-a-browser)
* [Testing](#testing)
* [Publishing](#publishing)
* [Acknowledgments](#acknowledgments)

## Quickstart

1. Web version:
Expand All @@ -43,7 +20,6 @@
1. Docker
1. Install Docker
1. From a terminal run `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
but replace the `/path/to/data` part of the command with your own path on your machine.
1. Python Library:
1. Install [Python](https://www.python.org/) (works with python2 and python3)
1. Install [Pip](https://pip.pypa.io/en/stable/installing/) package manager for python, if
Expand Down Expand Up @@ -78,11 +54,9 @@ Some of our awesome contributors include:

[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/0)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/0)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/1)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/1)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/2)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/2)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/3)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/3)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/4)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/4)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/5)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/5)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/6)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/6)[![](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/images/7)](https://sourcerer.io/fame/chrisfilo/bids-standard/bids-validator/links/7)

Please also see [Acknowledgments](#acknowledgments).

## Use

### API
#### API

The BIDS Validator has one primary method that takes a directory as either a
path to the directory (node) or the object given by selecting a directory with a
Expand All @@ -107,7 +81,7 @@ that we expose.

Additionally you can reformat stored errors against a new config using `validate.reformat()`

### .bidsignore
#### .bidsignore

Optionally one can include a `.bidsignore` file in the root of the dataset. This
file lists patterns (compatible with the [.gitignore syntax](https://git-scm.com/docs/gitignore))
Expand All @@ -120,7 +94,7 @@ specification.
extra_data/
```

### Configuration
#### Configuration

You can configure the severity of errors by passing a json configuration file
with a `-c` or `--config` flag to the command line interface or by defining a
Expand Down Expand Up @@ -252,77 +226,45 @@ This style of use puts limits on what configuration you can require, so for
complex scenarios, we advise users to create a dedicated configuration file with
contents as described above.

### In the Browser
#### In the Browser

The BIDS Validator currently works in the browser with [browserify](http://browserify.org/)
or [webpack](https://webpack.js.org/). You can add it to a project by cloning
the validator and requiring it with browserify syntax
`var validate = require('bids-validator');` or an ES2015 webpack import
`import validate from 'bids-validator'`.

### On the Server
#### On the Server

The BIDS validator works like most npm packages. You can install it by running
`npm install bids-validator`.

### Through Command Line
#### Through Command Line

If you install the bids validator globally by using `npm install -g bids-validator`
you will be able to use it as a command line tool. Once installed you should be
able to run `bids-validator /path/to/your/bids/directory` and see any validation
issues logged to the terminal. Run `bids-validator` without a directory path to
see available options.

## Docker image

[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/bids/validator?label=docker)](https://hub.docker.com/r/bids/validator)

To use bids validator with [docker](https://www.docker.com/), you simply need to
[install docker](https://docs.docker.com/install/) on your system.

And then from a terminal run:
- `docker run -ti --rm bids/validator --version` to print the version of the
docker image
- `docker run -ti --rm bids/validator --help` to print the help
- `docker run -ti --rm -v /path/to/data:/data:ro bids/validator /data`
to validate the dataset `/path/to/data` on your host machine

See here for a brief explanation of the commands:

- `docker run` is the command to tell docker to run a certain docker image,
usually taking the form `docker run <IMAGENAME> <COMMAND>`
- the `-ti` flag means the inputs are accepted and outputs are printed to the
terminal
- the `--rm` flag means that the state of the docker container is not saved
after it has run
- the `-v` flag is adding your local data to the docker container
([bind-mounts](https://docs.docker.com/storage/bind-mounts/)). Importantly,
the input after the `-v` flag consists of three fields separated colons: `:`
- the first field is the path to the directory on the host machine:
`/path/to/data`
- the second field is the path where the directory is mounted in the
container
- the third field is optional. In our case, we use `ro` to specify that the
mounted data is *read only*

## Python Library

[![PyPI version](https://badge.fury.io/py/bids-validator.svg)](https://badge.fury.io/py/bids-validator)

There are is a limited library of helper functions written in Python. The main function
determines if a file extension is compliant with the BIDS specification. You can find
the available functions in the library, as well as their descriptions,
[here](https://github.com/bids-standard/bids-validator/blob/master/bids-validator/bids_validator/bids_validator.py).
To install, run `pip install -U bids_validator` (requires python and pip).
To install, run `pip install bids_validator` (requires python and pip).

### Example
#### Example

```Python
from bids_validator import BIDSValidator
validator = BIDSValidator()
filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"]
for filepath in filepaths:
print(validator.is_bids(filepath)) # will print True, and then False
```
>>> from bids_validator import BIDSValidator
>>> validator = BIDSValidator()
>>> filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe"]
>>> for filepath in filepaths:
>>> print( validator.is_bids(filepath) )
True
False
```

## Development
Expand All @@ -332,10 +274,7 @@ root. This will install external dependencies. If you wish to install
`bids-validator` globally (so that you can run it in other folders), use the
following command to install it globally: `cd bids-validator && npm install -g`

Please see the [CONTRIBUTING.md](../CONTRIBUTING.md)
for additional details.

### Running Locally in a Browser
#### Running Locally in a Browser

A note about OS X, the dependencies for the browser require a npm package called
node-gyp which needs xcode to be installed in order to be compiled.
Expand All @@ -354,7 +293,7 @@ node-gyp which needs xcode to be installed in order to be compiled.
of any bugs you fix!
6. To ensure that the web application compiles successfully in production, run `yarn web-export`

### Testing
#### Testing

If it's your first time running tests, first use the command `git submodule update --init --depth 1` to pull the test example data. This repo contains the [bids-examples github repository](https://github.com/bids-standard/bids-examples) as a [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).

Expand All @@ -364,7 +303,7 @@ is useful to run tests while making changes. A coverage report is available with

To run the linter which checks code conventions run `npm run lint`.

### Publishing
#### Publishing

Publishing is done with [Lerna](https://github.com/lerna/lerna). Use the command `yarn lerna publish` and follow instructions to set a new version.

Expand All @@ -373,8 +312,7 @@ Using lerna publish will create a git commit with updated version information an
## Acknowledgments

Many contributions to the `bids-validator` were done by members of the
BIDS community. See the
[list of contributors](https://bids-specification.readthedocs.io/en/stable/99-appendices/01-contributors.html).
BIDS community. See the [list of contributors](https://github.com/bids-standard/bids-validator/graphs/contributors).

A large part of the development of `bids-validator` is currently done by
[Squishymedia](https://squishymedia.com/), who are in turn financed through
Expand Down
Loading

0 comments on commit a888d48

Please sign in to comment.