A modern, Python-driven environment for building, testing, benchmarking, and analyzing C++23 projects.
This project demonstrates a Notebook-First approach to C++ development. Instead of relying solely on complex CLI build systems like CMake or Makefiles, the entire development lifecycleβdependency management, compilation, testing, coverage analysis, and documentationβis orchestrated through a single Jupyter Notebook (builder.ipynb).
This approach allows for:
- Interactive Feedback: See build logs, test results, and coverage reports immediately within the notebook.
- Unified Pipeline: A single script handles formatting, linting, building, and benchmarking.
- Zero-Boilerplate: The notebook generates the necessary project structure and configuration files on the fly.
- C++23 Ready: Configured for the latest standard (
-std=c++23) using GCC/Clang. - Automated Dependency Management: Automatically downloads header-only libraries (e.g.,
doctest,nanobench). - TDD Pipeline: Runs unit tests before benchmarks. If tests fail, execution stops.
- Code Coverage: Generates HTML coverage reports using
lcovwith branch coverage support. - Performance Benchmarking: Integrated
nanobenchfor micro-benchmarking with HTML output. - Code Quality:
- Formatting: Auto-formats code using
clang-format(Google Style). - Linting: Static analysis via
clang-tidy. - Documentation: Auto-generates UML and API docs via
Doxygen.
- Formatting: Auto-formats code using
The builder.ipynb script automatically maintains the following structure:
.
βββ builder.ipynb # π§ The Build System & Runner
βββ src/ # π Source files (.cpp)
βββ include/ # π¦ Header files (.h) & Dependencies
βββ build/ # βοΈ Artifacts (Binaries, Object files)
βββ docs/ # π Generated Doxygen documentation
βββ .clang-format # π¨ Style configuration
βββ .clang-tidy # π§Ή Linter configuration
Ensure you have the following tools installed on your Linux system:
- Python 3.10+ (with
jupyterinstalled) - C++ Compiler:
g++(GCC 13+) orclang++ - Build Tools:
scons - Analysis Tools:
lcov,clang-format,clang-tidy,doxygen,graphviz
# Ubuntu/Debian example
sudo apt install g++ scons lcov clang-format clang-tidy doxygen graphviz python3-pip
pip install notebook
- Clone the repository:
git clone [https://github.com/your-username/your-repo.git](https://github.com/your-username/your-repo.git)
cd your-repo
- Open the Builder:
jupyter notebook builder.ipynb
- Run the Pipeline:
- Execute the initialization cells to set up the directory structure.
- Run the Pipeline cell to build, test, and benchmark the code.
- Run the Coverage cell to view the code coverage report.
- Run the Docs cell to generate and view Doxygen documentation.
The builder.ipynb implements the following logic:
- Setup: Check compiler version & download dependencies.
- Lint & Format: Enforce style guidelines.
- Build: Compile with
SCons(Debug/Release/Coverage modes). - Test: Run
doctestunit tests. - Benchmark: If tests pass, run
nanobench. - Report: Open HTML results for Coverage and Benchmarks.