Mentions légales du service

Skip to content
Snippets Groups Projects
Name Last commit Last update
docker
.gitlab-ci.yml
ClangTidy.ipynb
README.md

Table of Contents

Running the notebook

Dependencies

This notebook relies on several dependencies:

  • JupyterLab to handle the notebook itself.
  • CppyyKernel, a homemade project to run C++ code in notebooks. We will also use extensively a feature we introduced that enables to call compiler from the notebook over content of a given cell.
  • clang++ compiler.

Using the Docker image

The easiest way to run it is to use the Docker image provided with the project.

docker login registry.gitlab.inria.fr
docker pull registry.gitlab.inria.fr/sgilles/clangtidyfeedback/clang-tidy-feedback

Then run a container with:

docker run --rm -e JUPYTER_TOKEN='easy' -p 8888:8888  -v $PWD:/clang-tidy-feedback -w /clang-tidy-feedback --cap-drop=all registry.gitlab.inria.fr/sgilles/clang-tidy-feedback/clang-tidy-feedback:latest 

And in your browser type http://localhost:8888

and then type easy in the token dialog box (of course you may replace by whatever you want).

Few hints for those not familiar with Docker:

  • -v creates a mapping between local folder and the /clang-tidy-feedback folder in the container; this enables you to edit the file from your comfy local environment and see the file edited this way in the Docker container.
  • --cap-drop=all is a safety when you're running a Docker image not built by yourself: you're essentially blocking the few remaining operations that might impact your own environment that Docker lets by default open with the run command.
  • -p gives the port mapping between the Docker image and your local environment.
  • --rm tells docker to delete the container after its use.
  • -w tells to use as working directory the provided argument - which is here the mapped local folder.

The lengthy registry.gitlab.inria.fr/sgilles/clang-tidy-feedback/clang-tidy-feedback:latest is the name of the Docker image, if this image is not present locally in your environment Docker will try to fetch it from a registry on the Inria Gitlab.

Then just type http://localhost:8888/ in your browser to run the notebooks.

Install by yourself in your own environment

You may also run it in your usual environment; I let it to you to install properly compiler, JupyterLab following your tastes and habits.

The only unusual dependency is for our CppyyKernel project; the command to install it is:

pip install git+https://gitlab.inria.fr/sed-saclay/cppyy_kernel.git

Beware though to properly set your PATH variable so that clang-tidy may be found in it (it is explained in the notebook but if you overlook this it won't work).

The Dockerfiles both from CppyyKernel and this project will help you to set up fron scratch in an Ubuntu environment. The CppyyKernel one might seem a tad complicated, but we had to juggle with Ubuntu / Python / cppyy versions to make it work properly.