Skip to content

Commit 1e18868

Browse files
authored
feat(doc): improve operator Markdown documentation generation (#2635)
1 parent 7d910e4 commit 1e18868

File tree

13 files changed

+511
-247
lines changed

13 files changed

+511
-247
lines changed

.ci/generate_operators_doc.py

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

.github/workflows/scripts/separate_long_core_tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ New-Item -Path ".\" -Name "test_remote_workflow" -ItemType "directory"
77
New-Item -Path ".\" -Name "test_remote_operator" -ItemType "directory"
88
New-Item -Path ".\" -Name "test_service" -ItemType "directory"
99
New-Item -Path ".\" -Name "test_custom_type_field" -ItemType "directory"
10+
New-Item -Path ".\" -Name "test_documentation" -ItemType "directory"
1011
Copy-Item -Path "tests\conftest.py" -Destination ".\test_launcher\"
1112
Copy-Item -Path "tests\conftest.py" -Destination ".\test_server\"
1213
Copy-Item -Path "tests\conftest.py" -Destination ".\test_local_server\"
@@ -16,6 +17,7 @@ Copy-Item -Path "tests\conftest.py" -Destination ".\test_remote_workflow\"
1617
Copy-Item -Path "tests\conftest.py" -Destination ".\test_remote_operator\"
1718
Copy-Item -Path "tests\conftest.py" -Destination ".\test_service\"
1819
Copy-Item -Path "tests\conftest.py" -Destination ".\test_custom_type_field\"
20+
Copy-Item -Path "tests\conftest.py" -Destination ".\test_documentation\"
1921
Copy-Item -Path "tests\test_launcher.py" -Destination ".\test_launcher\"
2022
Copy-Item -Path "tests\test_server.py" -Destination ".\test_server\"
2123
Copy-Item -Path "tests\test_local_server.py" -Destination ".\test_local_server\"
@@ -25,6 +27,7 @@ Copy-Item -Path "tests\test_remote_workflow.py" -Destination ".\test_remote_work
2527
Copy-Item -Path "tests\test_remote_operator.py" -Destination ".\test_remote_operator\"
2628
Copy-Item -Path "tests\test_service.py" -Destination ".\test_service\"
2729
Copy-Item -Path "tests\test_custom_type_field.py" -Destination ".\test_custom_type_field\"
30+
Copy-Item -Path "tests\test_documentation.py" -Destination ".\test_documentation\"
2831
Remove-Item -Path "tests\test_server.py"
2932
Remove-Item -Path "tests\test_launcher.py"
3033
Remove-Item -Path "tests\test_local_server.py"
@@ -33,4 +36,5 @@ Remove-Item -Path "tests\test_workflow.py"
3336
Remove-Item -Path "tests\test_remote_workflow.py"
3437
Remove-Item -Path "tests\test_remote_operator.py"
3538
Remove-Item -Path "tests\test_service.py"
36-
Remove-Item -Path "tests\test_custom_type_field.py"
39+
Remove-Item -Path "tests\test_custom_type_field.py"
40+
Remove-Item -Path "tests\test_documentation.py"

.github/workflows/test_docker.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ jobs:
205205
command: |
206206
pytest $DEBUG $COVERAGE $RERUNS --junitxml=../tests/junit/test-results12.xml tests/operators/.
207207
208+
- name: "Test Documentation"
209+
uses: nick-fields/retry@v3
210+
with:
211+
timeout_minutes: 4
212+
max_attempts: 2
213+
shell: bash
214+
command: |
215+
pytest $DEBUG $COVERAGE $RERUNS --junitxml=../tests/junit/test-results13.xml test_documentation/.
216+
208217
# - name: "Test API Entry"
209218
# shell: bash
210219
# working-directory: tests

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,20 @@ plotting = [
6060
"imageio-ffmpeg",
6161
]
6262

63+
operator_doc = [
64+
# Operator documentation generation
65+
"jinja2",
66+
]
67+
6368
[project.urls]
6469
Homepage = "https://dpf.docs.pyansys.com/"
6570
Documentation = "https://dpf.docs.pyansys.com/"
6671
Source = "https://github.com/ansys/pydpf-core"
6772
Tracker = "https://github.com/ansys/pydpf-core/issues"
6873

74+
[project.scripts]
75+
dpf_generate_operators_doc = "ansys.dpf.core.documentation.generate_operators_doc:run_with_args"
76+
6977
[tool.ruff]
7078
line-length = 100
7179

@@ -115,4 +123,5 @@ where = ["src"]
115123

116124
[tool.setuptools.package-data]
117125
"ansys.dpf.gatebin" = ["*.so", "*.dll"]
126+
"ansys.dpf.core.documentation" = ["toc_template.j2", "operator_doc_template.md"]
118127

requirements/requirements_test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ coverage==7.10.6
33
graphviz==0.21
44
imageio==2.37.0
55
imageio-ffmpeg==0.6.0
6+
jinja2==3.1.6
67
pypandoc_binary==1.15
78
pytest==8.4.2
89
pytest-cov==6.2.1

src/ansys/dpf/core/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
AvailableServerContexts,
100100
LicenseContextManager
101101
)
102+
from ansys.dpf.core.server_types import AnyServerType # noqa: F401
102103
from ansys.dpf.core.unit_system import UnitSystem, unit_systems
103104
from ansys.dpf.core.incremental import IncrementalHelper, split_workflow_in_chunks
104105
from ansys.dpf.core.any import Any
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (C) 2020 - 2025 ANSYS, Inc. and/or its affiliates.
2+
# SPDX-License-Identifier: MIT
3+
#
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
"""Documentation generation tools."""

0 commit comments

Comments
 (0)