Skip to content
Merged
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
7 changes: 0 additions & 7 deletions .conda/bin/jenkins-server-customization

This file was deleted.

4 changes: 2 additions & 2 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package:
# Repeating name because of the following issue:
# https://github.com/conda/conda-build/issues/2475
name: brainiak
version: {{ GIT_DESCRIBE_TAG[1:] }}
version: {{ environ.get('GIT_DESCRIBE_TAG', 'v0.1.dev1')[1:] }}

about:
home: {{ data.get('url') }}
Expand All @@ -18,7 +18,7 @@ source:
path: ../

build:
number: {{ GIT_DESCRIBE_NUMBER }}
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
script_env:

# We need the source directory because conda removes source / working
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on: [pull_request]
jobs:
pypi:
env:
IGNORE_CONDA: true
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: mpi4py/setup-mpi@v1
- run: |
python3 -m pip install -U pip
- if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
./pr-check.sh
- if: ${{ contains(matrix.os, 'macos') }}
run: |
export CC=$(brew --prefix)/opt/llvm/bin/clang
export CXX=$(brew --prefix)/opt/llvm/bin/clang++
export LDFLAGS="-L/usr/local/opt/llvm/lib
-Wl,-rpath,/usr/local/opt/llvm/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/llvm/include $CPPFLAGS"
./pr-check.sh
- uses: codecov/codecov-action@v1
conda:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
python-version: ${{ matrix.python-version }}
- run: |
export CONDA_HOME=$CONDA
conda install conda-build
.conda/bin/build ${{ matrix.python-version }}
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Brain Imaging Analysis Kit
==========================

.. image:: https://travis-ci.org/brainiak/brainiak.svg?branch=master
:target: https://travis-ci.org/brainiak/brainiak
.. image:: https://github.com/brainiak/brainiak/actions/workflows/main.yml/badge.svg
:alt: Status of GitHub Actions workflow
:target: https://github.com/brainiak/brainiak/actions

.. image:: https://codecov.io/gh/brainiak/brainiak/branch/master/graph/badge.svg
:target: https://codecov.io/gh/brainiak/brainiak
Expand Down
18 changes: 2 additions & 16 deletions pr-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function exit_with_error_and_venv {
exit_with_error "$1"
}

if [ $(which conda) ]
if [ -z $IGNORE_CONDA ] && [ $(which conda) ]
then
export PYTHONNOUSERSITE=True
create_venv=create_conda_venv
Expand Down Expand Up @@ -113,27 +113,13 @@ python3 -m pip install -U pip || \
# brainiak will also be installed together with the developer dependencies, but
# we install it first here to check that installation succeeds without the
# developer dependencies.
python3 -m pip install $ignore_installed -U -e . || \
python3 -m pip install $ignore_installed -U -e .[matnormal] || \
exit_with_error_and_venv "Failed to install BrainIAK."

# install developer dependencies
python3 -m pip install $ignore_installed -U -r requirements-dev.txt || \
exit_with_error_and_venv "Failed to install development requirements."

# Source a user-specified Bash script to customize the installation.
# This option is not supported and should not be documented in user docs.
# In particular we use it on our CentOS 6 Jenkins server with .conda/bin/
customization_script_flag=$1
if [ ${customization_script_flag:-default} = "--customization-script" ]
then
customization_script=$2
if [ ${customization_script:-default} = "default" ]
then
exit_with_error_and_venv "Must specify customization script"
else
source $customization_script
fi
fi

# static analysis
./run-checks.sh || \
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-e .[matnormal] # Installing BrainIAK here ensures no requirement conflict.
coverage
flake8
flake8-print
Expand Down
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if [ -z $mpi_command ]
then
mpi_command=mpiexec
fi
$mpi_command -n 2 coverage run -m pytest
$mpi_command -n 2 coverage run -m mpi4py -m pytest

# Coverage produces empty files which trigger warnings on combine
find . -name ".coverage.*" -size 0 -print0 | xargs -0 rm -f
Expand Down
14 changes: 3 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
[flake8]
max-complexity = 10
ignore =
# Defaults
# https://gitlab.com/pycqa/flake8/blob/master/src/flake8/defaults.py
E121,
E123,
E126,
E226,
E24,
E704,
W503,
W504,
extend-ignore =
# Docstrings
D,

[coverage:run]
source = brainiak
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
import os
import site
import sys
import setuptools
from copy import deepcopy
Expand All @@ -12,6 +13,9 @@
"lower versions are not supported"
)

# https://github.com/pypa/pip/issues/7953#issuecomment-645133255
site.ENABLE_USER_SITE = "--user" in sys.argv[1:]

here = os.path.abspath(os.path.dirname(__file__))

# Get the long description from the README file
Expand Down
16 changes: 4 additions & 12 deletions tests/.flake8
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
[flake8]
max-complexity = 10
ignore =
# Defaults
# https://gitlab.com/pycqa/flake8/blob/master/src/flake8/defaults.py
E121,
E123,
E126,
E226,
E24,
E704,
W503,
W504,
extend-ignore =
# Print restriction only applies to libraries
T001,
T003
T003,
# Docstrings
D,
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import multiprocessing

from mpi4py import MPI
import pytest
import numpy
Expand All @@ -14,3 +16,10 @@ def seeded_rng():
random.seed(0)
numpy.random.seed(0)
tensorflow.random.set_seed(0)


skip_non_fork = pytest.mark.skipif(
multiprocessing.get_start_method() != "fork"
and MPI.COMM_WORLD.Get_attr(MPI.APPNUM) is not None,
reason="MPI only works with multiprocessing fork start method.",
)
3 changes: 3 additions & 0 deletions tests/fcma/test_mvpa_voxel_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import conftest

from brainiak.fcma.mvpa_voxelselector import MVPAVoxelSelector
from brainiak.searchlight.searchlight import Searchlight
from sklearn import svm
Expand All @@ -23,6 +25,7 @@
prng = RandomState(1234567890)


@conftest.skip_non_fork
def test_mvpa_voxel_selection():
data = prng.rand(5, 5, 5, 8).astype(np.float32)
# all MPI processes read the mask; the mask file is small
Expand Down
4 changes: 4 additions & 0 deletions tests/fcma/test_voxel_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import conftest

from brainiak.fcma.voxelselector import VoxelSelector
from scipy.stats.mstats import zscore
from sklearn import svm
Expand All @@ -37,6 +39,7 @@ def create_epoch():
return mat


@conftest.skip_non_fork
def test_voxel_selection():
fake_raw_data = [create_epoch() for i in range(8)]
labels = [0, 1, 0, 1, 0, 1, 0, 1]
Expand Down Expand Up @@ -80,6 +83,7 @@ def test_voxel_selection():
"results")


@conftest.skip_non_fork
def test_voxel_selection_with_two_masks():
fake_raw_data1 = [create_epoch() for i in range(8)]
fake_raw_data2 = [create_epoch() for i in range(8)]
Expand Down
5 changes: 5 additions & 0 deletions tests/searchlight/test_searchlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import numpy as np
from mpi4py import MPI
import conftest

from brainiak.searchlight.searchlight import Searchlight
from brainiak.searchlight.searchlight import Diamond, Ball
Expand All @@ -30,6 +31,7 @@ def cube_sfn(data, msk, myrad, bcast_var):
return None


@conftest.skip_non_fork
def test_searchlight_with_cube():
sl = Searchlight(sl_rad=3)
comm = MPI.COMM_WORLD
Expand Down Expand Up @@ -97,6 +99,7 @@ def diamond_sfn(data, msk, myrad, bcast_var):
return None


@conftest.skip_non_fork
def test_searchlight_with_diamond():
sl = Searchlight(sl_rad=3, shape=Diamond)
comm = MPI.COMM_WORLD
Expand Down Expand Up @@ -136,6 +139,7 @@ def ball_sfn(data, msk, myrad, bcast_var):
return None


@conftest.skip_non_fork
def test_searchlight_with_ball():
sl = Searchlight(sl_rad=3, shape=Ball)
comm = MPI.COMM_WORLD
Expand Down Expand Up @@ -212,6 +216,7 @@ def block_test_sfn(data, msk, myrad, bcast_var, extra_params):
return outmat[myrad:-myrad, myrad:-myrad, myrad:-myrad]


@conftest.skip_non_fork
def test_correctness(): # noqa: C901
def voxel_test(data, mask, max_blk_edge, rad):

Expand Down