Skip to content

Latest commit

 

History

History
208 lines (150 loc) · 9.19 KB

README.md

File metadata and controls

208 lines (150 loc) · 9.19 KB

Unit tests: Ubuntu Unit tests: macOS Regression test Python wheels

Static analysis checks Sanitiser checks codecov

Prepare Decoding

Tool to compute decoding quantities.

Quickstart

Install the Python package from PyPI

Most functionality is available through a Python package which can be installed with:

pip install asmc-preparedecoding

This Python package is currently available on Linux (x86_64 and aarch64) and macOS (Apple Silicon).

Examples for using the Python package can be found in the following Jupyter notebook:

Please note that you must install Jupyter in order to view the notebook, and then open it:

pip install jupyter
jupyter-notebook notebooks/CreatingDecodingQuantities.ipynb

Compiling the C++ library and executable

Get the source:

git clone https://github.com/PalamaraLab/PrepareDecoding.git
cd PrepareDecoding

You need a C++17 compiler and CMake 3.25 or later (pip install cmake gets a recent one). GMP, MPFR and zlib should be obtained from your package manager prior to the CMake configuration step. Other dependencies (Eigen, {fmt}, cereal, cxxopts, and Catch2 for the tests) are fetched automatically by CMake.

  • Ubuntu/Debian:

    sudo apt install cmake libgmp-dev libmpfr-dev zlib1g-dev
  • CentOS/Fedora:

    sudo dnf install cmake gmp-devel mpfr-devel zlib-devel
  • macOS:

    brew install cmake gmp mpfr

Configuring and compiling the project

This project uses CMake.

Create a build directory:

mkdir build
cd build

Configure, and build the PrepareDecoding library and executable:

cmake ..
cmake --build . --parallel 4 --target prepare_decoding_lib
cmake --build . --parallel 4 --target prepare_decoding_exe

You can optionally build the and run the unit tests:

cmake --build . --parallel 4 --target unit_tests
ctest --output-on-failure

Extra tools for C++ developers

Coverage

Configure with coverage enabled, using g++ or clang++:

cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
cmake --build . --parallel 2 --target unit_tests
ctest -j2 --output-on-failure
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/_deps/*' '*/test/*' --output-file coverage.info
lcov --list coverage.info

Static analysis

This project is configured to work with clang tidy and cppcheck. Enable the relevant option and compile with clang++. Any finding fails the build, in CI too: fix it, or suppress a false positive where it occurs with a comment saying why (see cmake/StaticAnalysers.cmake). The checks clang-tidy runs are listed in .clang-tidy.

For clang tidy (add -DCLANGTIDY=/path/to/clang-tidy-NN to choose a version):

cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANG_TIDY=ON
cmake --build . --parallel 2 --target prepare_decoding_lib prepare_decoding_exe

For cppcheck:

cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_CPPCHECK=ON
cmake --build . --parallel 2 --target prepare_decoding_lib prepare_decoding_exe

Sanitisers

This project is configured to work with various LLVM sanitisers. Enable the relevant option, compile with clang++, and run the unit tests.

cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITISER_{{{SANITISER}}}=ON
cmake --build . --parallel 2 --target unit_tests
./test/unit_tests

where {{{SANITISER}}} is one of:

For developers: maintaining the project

Versions to check occasionally

Last reviewed: December 2026.

Dependabot updates the GitHub Actions (pinned by commit SHA) weekly. Everything else below is updated by hand: check each for a newer release every few months, and when a new Python version comes out.

What Version Where it is set
Eigen 5.0.1 cmake/Dependencies.cmake
{fmt} 12.2.1 cmake/Dependencies.cmake
cereal 1.3.2 cmake/Dependencies.cmake
cxxopts 3.3.1 cmake/Dependencies.cmake
Catch2 3.16.1 cmake/Dependencies.cmake
pybind11 3.1.0 pyproject.toml and cmake/Dependencies.cmake: keep them equal
scikit-build-core ≥ 1.1 pyproject.toml: the minimum also selects its default behaviour
cibuildwheel 4.3.5 python-wheels.yml (Dependabot)
zizmor 1.31.1 zizmor-audit.yml
Python 3.11 – 3.15 see adding a Python version
CI runners Ubuntu 26.04, macOS 15 .github/workflows
CI compilers GCC 15, Clang 22 .github/workflows (CXX, and CLANGTIDY in static analysis)
macOS deployment target 15.0 pyproject.toml: must match the macOS runner, as Homebrew's libraries target it
Minimum CMake 3.25 CMakeLists.txt (cmake_minimum_required), and this README
C++ standard C++17 CMakeLists.txt
GMP, MPFR, zlib not pinned system package managers: apt, brew, and dnf in the manylinux image

Updating a dependency

  • A C++ dependency: in cmake/Dependencies.cmake, change the archive URL and set URL_HASH to the new archive's SHA256 (download it and run sha256sum).
  • pybind11: change both pyproject.toml and cmake/Dependencies.cmake.
  • The regression reference outputs in test/regression are never regenerated just to make a test pass. If an update changes the output, find out why; regenerate them only for an intended change, in a commit of its own that says what changed.

Adding a Python version

cibuildwheel builds wheels for every Python version that requires-python in pyproject.toml allows, including free-threaded builds, once cibuildwheel itself supports that version. So:

To drop a version, raise requires-python and remove its classifier.

Making a release

License

This project is currently released under the GNU General Public License Version 3.