The easiest way to install bats is using pip

pip install bats-tda # gcc

To use clang (e.g. on a Mac) try

CC=clang pip install bats-tda # clang

Because bats uses OpenMP, it has to be compiled from source with a C++17 compliant complier. This means installation can take a few minutes. You can pass --verbose to pip to see what is going on with installation.

If you don’t have OpenMP, you can install with a package manager.

GCC (e.g. on Linux)

dnf install libgomp-devel # Fedora
apt-get install libgomp1-dev # Ubuntu

Clang (e.g. on Mac)

brew install libomp

Compiling from Source

You can also complile bats from the source code. This can be useful for debugging installation or contributing to bats.

conda create -n bats python=3
conda install numpy matplotlib

if you want to use ipython notebooks, you may want to install

conda install ipython notebook

clone repository use recursive option for submodules

git clone --recurse-submodules

or if you want to use https protocol:

git clone --recurse-submodules

Assuming you cloned the repository successfully, just move to the root directory of the repository and install

python install

If you want to use clang (for example, on a mac), try

CC=clang python install


Some useful commands for development:

build in directory

python build_ext --inplace

update submodules

git submodule update --remote

pull and update submodules

git pull --recurse-submodules

force a new build (-f), use parallelism (-j)

python build_ext -f -j4
python install

Testing uses the unittest framework. See documentation here.

Running all tests

First, you need to have the bats module built in-place.

python build_ext --inplace

From the root of the repository, run

python -m unittest discover

Running individual test files

From, you can run individual test files

python -m unittest


If you want to update to the latest development version, you need to pull and re-build. From the repository root directory:

git pull --recurse-submodules
python build --force # rebuilds all pybind executables
python install