Skip to content

Commit 779f737

Browse files
enirolfvepadulano
authored andcommitted
Document how to document pythonizations
1 parent ba695e1 commit 779f737

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

_data/navigation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ for_developers:
158158
url: for_developers/docs/guidelines
159159
- title: Running Doxygen locally
160160
url: for_developers/docs/local_doxygen
161+
- title: Documenting ROOT Pythonizations
162+
url: for_developers/docs/pythonizations
161163
- title: Useful tips
162164
url: for_developers/docs/useful_tips
163165
- title: Editing the ROOT website
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Documenting ROOT Pythonizations
3+
layout: single
4+
toc: no
5+
toc_sticky: no
6+
sidebar:
7+
nav: "for_developers"
8+
---
9+
10+
Some ROOT classes have *pythonizations* that require additional documentation. These can be added as special boxes to the rendered Doxygen page of their corresponding C++ class. As an example, see the Python-specific [RDataFrame](https://root.cern/doc/master/classROOT_1_1RDataFrame.html#python) docs. This documentation is written in the pythonization files corresponding to the original C++ class, which can be found in `<root_sources>/bindings/pyroot/pythonizations/python/ROOT/_pythonization`. Documentation is added as a module-level docstring, which should following the template below, replacing `{CLASS_NAME}` with the corresponding C++ class name, `{BLOCK_TITLE}` with the title of the documentation block (in most cases, "PyROOT" is used) and `{DOCUMENTATION_BODY}` with the documentation body, which supports the usual Doxygen tags and other formatting methods (see also the [documentation formatting tips](../useful_tips)).
11+
12+
```
13+
r"""
14+
/**
15+
\class {CLASS_NAME}
16+
\brief \parblock \endparblock
17+
\htmlonly
18+
<div class="pyrootbox">
19+
\endhtmlonly
20+
\anchor python
21+
22+
## {BLOCK_TITLE}
23+
24+
{DOCUMENTATION_BODY}
25+
26+
\htmlonly
27+
</div>
28+
\endhtmlonly
29+
*/
30+
"""
31+
```
32+
33+
The `\anchor` tag adds a permalink to the PyROOT box on rendered documentation page, allowing for easy linking to the Python-specific documentation by appending `#python` to the URL of the doxygen page (i.e., [https://root.cern/doc/master/classROOT_1_1RDataFrame.html#python](https://root.cern/doc/master/classROOT_1_1RDataFrame.html#python)).

0 commit comments

Comments
 (0)