Skip to content

Development

Installation from Source

If you want to contribute to pod5 or if our pre-built binaries do not meet your platform requirements, you can build pod5 from source using the instructions below.

Developing with Conan

For this development process you will need Conan installed. You can install conan<2 using pip or your platforms' package manager (e.g. brew) You will also need the python setuptools_scm==7.1.0 package to manage pod5 versioning:

# Conan and python build dependencies
$ pip install "conan<2" build
$ conan --version
Conan version 1.48.0
# Get the repo and submodules
$ git clone https://github.com/nanoporetech/pod5-file-format.git
$ cd pod5-file-format
$ git submodule update --init --recursive

Create _version.py and cmake/POD5Version.cmake which are ignored by git

pip install setuptools_scm==7.1.0
python -m setuptools_scm
python -m pod5_make_version

Install libs for a Release build using the system default compiler + settings

Note the build=missing, will build any libs not available on your current platform as binaries

mkdir build
cd build
conan install --build=missing -s build_type=Release .. 
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake ..
make -j

Arm 64 MacOS Builds

Note

On OSX arm builds, an extra argument may be needed to make cmake build an arm64 build on all OSX platforms:

cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 ..

Developing

Building the project requires that several tools and libraries are available

sudo apt install -y -V ca-certificates lsb-release wget
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt update

# Now install the rest of the dependencies
sudo apt install cmake libzstd-dev libzstd-dev libflatbuffers-dev

# Finally start build of POD5

git clone https://github.com/nanoporetech/pod5-file-format.git
cd pod5-file-format
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make -j

Python Development Setup

After completing the required stages above, create a python virtual environment and install an editable build of the pod5 package with additional [dev] dependencies.

python3.10 -m venv .venv --prompt=pod5
pip install -e python/pod5/[dev]

After activating your python virtual environment you should be able to check your installation with

source .venv/bin/activate
pod5 --version

Installing Pre-commit Hooks

The project uses pre-commit to ensure code is consistently formatted, you can install and run the pre-commit hooks

cd pod5-file-format

# Install pre-commit hooks in your pod5-file-format repo:
pip install pre-commit==v2.21.0
pre-commit install

# Run hooks on all files:
pre-commit run --all-files