Skip to content

Commit 7cc8ccc

Browse files
committed
build: Bump version to v0.19.2
2 parents 89e58a5 + 2d39a32 commit 7cc8ccc

32 files changed

+583
-594
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ unittest:
2222
build-doc:
2323
@sudo rm -rf /home/ansys/.local/share/ansys_fluent_core/examples/*
2424
@pip install -r requirements/requirements_doc.txt
25+
@python doc/api_rstgen.py
2526
@xvfb-run make -C doc html
2627
@touch doc/_build/html/.nojekyll
2728
@echo "$(DOCS_CNAME)" >> doc/_build/html/CNAME

doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ help:
1616
# Catch-all target: route all unknown targets to Sphinx using the new
1717
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1818
%: Makefile
19+
python api_rstgen.py;
1920
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2021
@cp -f "$(SOURCEDIR)/_static/sphx_glr_post_processing_exhaust_manifold_011.png" "$(BUILDDIR)/html/_images/"
2122
@cp -f "$(SOURCEDIR)/_static/sphx_glr_post_processing_exhaust_manifold_012.png" "$(BUILDDIR)/html/_images/"

doc/api_rstgen.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"""Provides a module for generating PyFluent API RST files."""
2+
3+
from pathlib import Path
4+
5+
6+
def _get_folder_path(folder_name: str):
7+
"""Get folder path.
8+
9+
Parameters
10+
----------
11+
folder_name: str
12+
Name of the folder.
13+
14+
Returns
15+
-------
16+
Path of the folder.
17+
"""
18+
return (Path(__file__) / ".." / "source" / folder_name).resolve()
19+
20+
21+
def _get_file_path(folder_name: str, file_name: str):
22+
"""Get file path.
23+
24+
Parameters
25+
----------
26+
folder_name: str
27+
Name of the folder.
28+
29+
file_name: str
30+
Name of the file.
31+
32+
Returns
33+
-------
34+
Path of the file.
35+
"""
36+
return (
37+
Path(__file__) / ".." / "source" / folder_name / f"{file_name}.rst"
38+
).resolve()
39+
40+
41+
hierarchy = {
42+
"visualization": [
43+
"Mesh",
44+
"Surface",
45+
"Contour",
46+
"Vector",
47+
"Pathline",
48+
"XYPlot",
49+
"Monitor",
50+
"GraphicsWindow",
51+
]
52+
}
53+
54+
55+
def _write_common_rst_members(rst_file):
56+
rst_file.write(" :members:\n")
57+
rst_file.write(" :show-inheritance:\n")
58+
rst_file.write(" :undoc-members:\n")
59+
rst_file.write(" :exclude-members: __weakref__, __dict__\n")
60+
rst_file.write(" :special-members: __init__\n")
61+
# rst_file.write(" :autosummary:\n")
62+
63+
64+
def _generate_api_source_rst_files(folder: str, files: list):
65+
for file in files:
66+
if not file.endswith("_contents"):
67+
rst_file = _get_file_path(folder, file)
68+
with open(rst_file, "w", encoding="utf8") as rst:
69+
rst.write(f".. _ref_{file}:\n\n")
70+
rst.write(f"{file}\n")
71+
rst.write(f'{"="*(len(f"{file}"))}\n\n')
72+
rst.write(f".. autoclass:: ansys.fluent.visualization.{file}\n")
73+
_write_common_rst_members(rst_file=rst)
74+
75+
76+
def _generate_api_index_rst_files():
77+
for folder, files in hierarchy.items():
78+
Path(_get_folder_path(folder)).mkdir(parents=True, exist_ok=True)
79+
_generate_api_source_rst_files(folder, files)
80+
folder_index = _get_file_path(folder, f"{folder}_contents")
81+
with open(folder_index, "w", encoding="utf8") as index:
82+
index.write(f".. _ref_{folder}:\n\n")
83+
index.write(f"{folder}\n")
84+
index.write(f'{"=" * (len(f"{folder}"))}\n\n')
85+
index.write(f".. automodule:: ansys.fluent.{folder}\n")
86+
_write_common_rst_members(rst_file=index)
87+
index.write(".. toctree::\n")
88+
index.write(" :maxdepth: 2\n")
89+
index.write(" :hidden:\n\n")
90+
for file in files:
91+
index.write(f" {file}\n")
92+
index.write("\n")
93+
94+
95+
if __name__ == "__main__":
96+
_generate_api_index_rst_files()

doc/make.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ set SPHINXOPTS=-j auto -W --keep-going -w build_errors.txt -N -q
1616
if "%1" == "" goto help
1717
if "%1" == "clean" goto clean
1818

19+
python api_rstgen.py
20+
1921
%SPHINXBUILD% >NUL 2>NUL
2022
if errorlevel 9009 (
2123
echo.

doc/source/api/index.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

doc/source/api/visualization/contour.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

doc/source/api/visualization/graphics.rst

Lines changed: 0 additions & 35 deletions
This file was deleted.

doc/source/api/visualization/graphics_windows_manager.rst

Lines changed: 0 additions & 45 deletions
This file was deleted.

doc/source/api/visualization/index.rst

Lines changed: 0 additions & 119 deletions
This file was deleted.

doc/source/api/visualization/mesh.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/source/api/visualization/monitorplot.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/source/api/visualization/pathlines.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)