File: README.md

package info (click to toggle)
camitk 6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 389,496 kB
  • sloc: cpp: 103,476; sh: 2,448; python: 1,618; xml: 984; makefile: 128; perl: 84; sed: 20
file content (52 lines) | stat: -rw-r--r-- 1,591 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# How to generate documentation and stub

This subdirectory contains all the required tools and script to generate the documentation for the CamiTK bindings and the stub file for providing interactive helps during coding in VSCode.

This is done in three steps:

1. extract the docstrings automatically from the doxygen documentation using pybind_mkdoc
2. manually add documentation to python bindings
3. generate the stub from the camitk python module

## Dependencies

The first steps requires pybond11_mkdoc to generate docstrings while the last steps requires pybind11-stubgen.

## Install

```bash
python -m venv .venv
.venv/bin/pip install git+https://github.com/pybind/pybind11_mkdoc.git@master
.venv/bin/pip install pybind11-stubgen numpy 
sudo apt install libclang-20-dev
```
!!! Note libclang-dev >= 20 is required by pybind11_mkdoc

!!! Note numpy is required by camitk

## Step 1: extract documentation strings

- modify/setup the paths (especially CamiTK, Clang, Qt and VTK version) in the `generate-docstrings.sh` script
- run ./make-docstrings-for-camitk-python-bindings.sh

This generates the `docstring.h` file.

## Step 2: add docstring to exported function

For instance:

```cpp
  py::class_<camitk::Application> application(m, "Application", DOC(camitk_Application));

    application.def_static("getAction", &camitk::Application::getAction,
        py::return_value_policy::reference,
        DOC(camitk_Application_getAction));

        ...
```

## 5. Generate stub files

```bash
PYTHONPATH=../camitk/build/lib .venv/bin/pybind11-stubgen camitk --output-dir stubs
```