Developer Information#

The following information is intended for developers who wish to modify the code.

The pages on Testing and Documentation are also relevant.

Building BridgeStan#

Developers should follow the instructions in Getting Started to ensure they have the minimal C++ build tools required for working with BridgeStan.

Besides the normal build commands used by users, developers may find the following commands useful when working on BridgeStan itself:

  • make format: Format all source code according to the project’s style guidelines. This will be checked by CI, so it’s a good idea to run before each push.

  • make test_models: Build all of the models in the test_models/ directory at once.

  • make docs: Build these docs (see Documentation).

C++#

  • We use the C++17 standard for compilation (-std=c++17 in both clang and gcc). This is what Stan requires since version 2.36.

  • We try to write standards-compliant code that does not depend on features of specific platforms (except where needed for compatibility).

    Specifically, we do not use OS-dependent or compiler-dependent C++. Our C++ code does not depend on the R.h or Python.h headers, for example. On the other hand, adding new signatures to work with a specific language’s style of foreign function interface is permitted (an example can be found in the R compatibility functions, which requires a particular pointer-based style).

  • We try to follow the Google C++ Style Guide, but (a) we allow C++ exceptions, and (b) we allow reference arguments.

  • We recommend using Clang format with our config file .clang-format.

Python#

Julia#

R#

  • R dependencies:

  • R code is formatted using air.

Rust#

  • Rust development is based on cargo, which should handle dependencies and formatting.