Skip to content

Commit afd6c27

Browse files
author
Foucher Alexandre
committed
add python example
1 parent 506be8b commit afd6c27

File tree

18 files changed

+412
-23
lines changed

18 files changed

+412
-23
lines changed

cpp-example/docs/source/conf.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,35 @@
1111
author = 'Alexandre Foucher'
1212
release = '1.0'
1313

14+
# -- Options for HTML output -------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
16+
17+
html_theme = 'sphinx_rtd_theme'
18+
html_static_path = ['_static']
19+
1420
# -- General configuration ---------------------------------------------------
1521
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1622

17-
extensions = [
18-
'breathe',
19-
'exhale'
20-
]
23+
extensions = []
24+
25+
templates_path = ['_templates']
26+
exclude_patterns = []
27+
28+
language = 'fr'
29+
30+
# -----------------------------------------------------------------------------
31+
32+
extensions += ['breathe','exhale']
2133

2234
breathe_projects = {"My Project": "../build/_doxygen/xml"}
2335
breathe_default_project = "My Project"
2436

2537
exhale_args = {
26-
# These arguments are required
2738
"containmentFolder": "./api",
2839
"rootFileName": "library_root.rst",
2940
"doxygenStripFromPath": "..",
30-
# Heavily encouraged optional argument (see docs)
3141
"rootFileTitle": "Library API",
32-
# Suggested optional arguments
3342
"createTreeView": True,
34-
# TIP: if using the sphinx-bootstrap-theme, you need
35-
# "treeViewIsBootstrap": True,
3643
"exhaleExecutesDoxygen": True,
3744
"exhaleDoxygenStdin": "INPUT = ../../include"
38-
}
39-
40-
templates_path = ['_templates']
41-
exclude_patterns = []
42-
43-
language = 'fr'
44-
45-
# -- Options for HTML output -------------------------------------------------
46-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
47-
48-
html_theme = 'shibuya'
49-
html_static_path = ['_static']
45+
}

cpp-example/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
```sh
1010
# Installing dependencies
11-
pip3 install sphinx shibuya breathe exhale
11+
pip3 install sphinx sphinx_rtd_theme breathe exhale
1212
sudo apt-get install doxygen
1313

1414
# Generating documentation
@@ -85,5 +85,5 @@ The best way is to go in `source/index.rst` and add `api/library_root` as an ent
8585
Inside the `docs` directory you can now execute `make html` !
8686
You can acces it through `docs/build/html/index.html`.
8787

88-
> :warning: **Warning**
88+
> **Warning**
8989
> Do not store the `build` folder in your remote storage, if you use `git` simply copy the `.gitignore` inside `cpp-example/docs` and paste it to your `docs` folder.

py-example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/__pycache__/

py-example/docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
source/api

py-example/docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

py-example/docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:orphan:
2+
3+
{{ fullname | escape | underline}}
4+
5+
.. currentmodule:: {{ module }}
6+
7+
attribute
8+
9+
.. auto{{ objtype }}:: {{ fullname | replace("numpy.", "numpy::") }}
10+
11+
{# In the fullname (e.g. `numpy.ma.MaskedArray.methodname`), the module name
12+
is ambiguous. Using a `::` separator (e.g. `numpy::ma.MaskedArray.methodname`)
13+
specifies `numpy` as the module name. #}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% if objtype == 'property' %}
2+
:orphan:
3+
{% endif %}
4+
5+
{{ fullname | escape | underline}}
6+
7+
.. currentmodule:: {{ module }}
8+
9+
{% if objtype == 'property' %}
10+
property
11+
{% endif %}
12+
13+
.. auto{{ objtype }}:: {{ fullname | replace("numpy.", "numpy::") }}
14+
15+
{# In the fullname (e.g. `numpy.ma.MaskedArray.methodname`), the module name
16+
is ambiguous. Using a `::` separator (e.g. `numpy::ma.MaskedArray.methodname`)
17+
specifies `numpy` as the module name. #}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% extends "!autosummary/class.rst" %}
2+
3+
{% block methods %}
4+
{% if methods %}
5+
.. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
6+
.. autosummary::
7+
:toctree:
8+
{% for item in all_methods %}
9+
{%- if not item.startswith('_') or item in ['__call__'] %}
10+
{{ name }}.{{ item }}
11+
{%- endif -%}
12+
{%- endfor %}
13+
{% endif %}
14+
{% endblock %}
15+
16+
{% block attributes %}
17+
{% if attributes %}
18+
.. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
19+
.. autosummary::
20+
:toctree:
21+
{% for item in all_attributes %}
22+
{%- if not item.startswith('_') %}
23+
{{ name }}.{{ item }}
24+
{%- endif -%}
25+
{%- endfor %}
26+
{% endif %}
27+
{% endblock %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:orphan:
2+
3+
{{ fullname | escape | underline}}
4+
5+
.. currentmodule:: {{ module }}
6+
7+
member
8+
9+
.. auto{{ objtype }}:: {{ fullname | replace("numpy.", "numpy::") }}
10+
11+
{# In the fullname (e.g. `numpy.ma.MaskedArray.methodname`), the module name
12+
is ambiguous. Using a `::` separator (e.g. `numpy::ma.MaskedArray.methodname`)
13+
specifies `numpy` as the module name. #}

0 commit comments

Comments
 (0)