Skip to content

Commit a5a6250

Browse files
committed
Merge branch 'master' into mhanmer/operator_doc_template
2 parents c7b661b + 404befa commit a5a6250

File tree

9 files changed

+115
-30
lines changed

9 files changed

+115
-30
lines changed

.ci/build_wheel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"win": "win_amd64",
1616
"manylinux1": "manylinux1_x86_64",
1717
"manylinux_2_17": "manylinux_2_17_x86_64",
18-
"linux": "manylinux_2_17_x86_64", # Accommodate tox.ini platform substitutions
18+
# Accommodate tox.ini automatic platform substitutions
19+
"linux": "manylinux_2_17_x86_64",
1920
"win32": "win_amd64",
2021
"darwin": "any",
2122
}

doc/make.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if "%SPHINXBUILD%" == "" (
99
)
1010
set SOURCEDIR=source
1111
set BUILDDIR=build
12+
set SPHINXOPTS=-n
1213

1314
if "%1" == "" goto help
1415
if "%1" == "clean" goto clean

doc/source/user_guide/custom_operators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,5 @@ Once the plugin is loaded, you can instantiate the custom operator:
249249
250250
References
251251
----------
252-
For more information, see :ref:`ref_custom_operator` in the **API reference**
252+
For more information, see :py:mod:`Custom Operator Base <ansys.dpf.core.custom_operator>` in the **API reference**
253253
and :ref:`python_operators` in **Examples**.

doc/source/user_guide/fields_container.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,5 +574,5 @@ For comprehensive information on chaining operators, see :ref:`ref_user_guide_op
574574

575575
API reference
576576
-------------
577-
For more information, see :ref:`ref_fields_container` and
578-
:ref:`ref_field` in the **API reference**.
577+
For more information, see :py:mod:`FieldsContainer <ansys.dpf.core.fields_container>` and
578+
:py:mod:`Field <ansys.dpf.core.field>` in the **API reference**.

doc/source/user_guide/model.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ To understand what is available in the result file, you can print the model
6363
6464
For a comprehensive model example, see :ref:`ref_basic_example`.
6565

66-
For a description of the ``Model`` object, see :ref:`ref_model`.
66+
For a description of the ``Model`` object, see :py:mod:`Model <ansys.dpf.core.model>`.
6767

6868

6969
Model metadata
@@ -125,7 +125,7 @@ This example shows how you get time sets:
125125
[1.]
126126
127127
128-
For a description of the ``Metadata`` object, see :ref:`ref_model`.
128+
For a description of the ``Metadata`` object, see :py:mod:`Model <ansys.dpf.core.model>`.
129129

130130
Model results
131131
-------------
@@ -176,11 +176,11 @@ the mesh scoping:
176176
177177
For an example using the ``Result`` object, see :ref:`ref_transient_easy_time_scoping`.
178178

179-
For a description of the ``Model`` object, see :ref:`ref_results`.
179+
For a description of the ``Model`` object, see :py:mod:`Model <ansys.dpf.core.model>`.
180180

181181

182182

183183
API reference
184184
~~~~~~~~~~~~~
185185

186-
For more information, see :ref:`ref_model` or :ref:`ref_results`.
186+
For more information, see :py:mod:`Model <ansys.dpf.core.model>` or :py:mod:`Results <ansys.dpf.core.results>`.

doc/source/user_guide/operators.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ which is progressively enhanced, see :ref:`ref_dpf_operators_reference`.
5959

6060
Create operators
6161
~~~~~~~~~~~~~~~~
62-
Each operator is of type :ref:`ref_operator`. You can create an instance
62+
Each operator is of type :py:mod:`Operator <ansys.dpf.core.dpf_operator>`. You can create an instance
6363
in Python with any of the derived classes available in the
64-
:ref:`ansys.dpf.core.operators package` or directly with the :ref:`ref_operator`
64+
:py:mod:`ansys.dpf.core.operators` package or directly with the :py:mod:`Operator <ansys.dpf.core.dpf_operator>`
6565
class using the internal name string that indicates the operator type.
6666
For more information, see :ref:`ref_dpf_operators_reference`.
6767

@@ -123,8 +123,8 @@ results, you must provide paths for the result files.
123123

124124
You can create data sources in two ways:
125125

126-
- Use the :ref:`ref_model` class.
127-
- Use the :ref:`ref_data_sources` class.
126+
- Use the :py:mod:`Model <ansys.dpf.core.model>` class.
127+
- Use the :py:mod:`Data Sources <ansys.dpf.core.data_sources>` class.
128128

129129

130130
Because several other examples use the ``Model`` class, this example uses the
@@ -154,7 +154,7 @@ This code demonstrates how to connect the data source to the displacement operat
154154
op.inputs.data_sources(data_src)
155155
156156
You can connect other optional inputs to the displacement operator.
157-
The output from printing the operator shows that a ``mesh_scoping`` of type :ref:`ref_scoping`
157+
The output from printing the operator shows that a ``mesh_scoping`` of type :py:mod:`Scoping <ansys.dpf.core.scoping>`
158158
can be connected to work on a spatial subset. A ``time_scoping`` of a list of integers
159159
can also be connected to work on a temporal subset:
160160

@@ -441,5 +441,5 @@ Python client is not on the same machine as the server:
441441
API reference
442442
~~~~~~~~~~~~~
443443
For a list of all operators in DPF, see :ref:`ref_dpf_operators_reference`
444-
or the package :ref:`ansys.dpf.core.operators package`. For more information about the
445-
class itself, see :ref:`ref_operator`.
444+
or the package :py:mod:`ansys.dpf.core.operators`. For more information about the
445+
class itself, see :py:mod:`Operator <ansys.dpf.core.dpf_operator>`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
"""Provide helpers relating to streamline computation, argument filtering, and text indenting."""
23+
24+
from .streamlines import *
25+
from .utils import *

src/ansys/dpf/core/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
Model.
2525
2626
Module contains the Model class to manage file result models.
27-
2827
"""
2928

3029
from __future__ import annotations

tox.ini

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# This is work in progress, testing workflow in local/CI is gradually being transferred to tox
22

33
# Usage instructions:
4+
45
# `tox` will run all tests sequentially, `tox --parallel` will run all tests in parallel (much faster).
56
# Run specific selection of tests with `tox -e pretest,<list-of-tests>,posttest` e.g., `tox -e pretest,test-api,test-launcher,posttest`
67
# `--parallel` flag can be passed when running specific selections.
78

9+
# For packaging, build wheels for specific platform with `tox -e build-wheel -- <platform_name>`.
10+
# If `tox -e build-wheel` is run without passing a platform, tox will automatically build the ffl wheels based on the operating system
11+
# on which it is executing: windows -> "win_amd64", linux -> "manylinux_2_17_x86_64", mac -> "any"
12+
813
[tox]
914
description = Default tox environment list and core configurations
1015

11-
# List all tests to run in parallel or sequential mode here
12-
# So invocation can be specified as `tox`/`tox --parallel` to run all tests in sequential/parallel mode
1316
envlist = pretest,test-{api,launcher,server,local_server,multi_server,remote_workflow,remote_operator,workflow,service,operators},posttest
1417

1518
isolated_build_env = build
@@ -24,17 +27,6 @@ pass_env =
2427
ANSYSLMD_LICENSE_FILE
2528
AWP_ROOT242
2629

27-
package = external # To allow custom wheel builds
28-
29-
[testenv:build_external]
30-
description = Environment for custom build of package wheels, solves PyDPF custom wheel building requirement
31-
32-
package_glob = {toxinidir}{/}dist{/}ansys_dpf_core*
33-
34-
# {on_platform} substitution to automatically detect os type.
35-
commands =
36-
python .ci/build_wheel.py -p {on_platform} -w
37-
3830
[testenv:pretest]
3931
description = Environment to kill servers and organize test files prior to testing
4032

@@ -115,4 +107,71 @@ deps =
115107
-r requirements/requirements_test.txt
116108

117109
commands =
118-
pytest {env:PYTEST_PYTHON_FILES} {env:DEBUG} {env:COVERAGE} {env:RERUNS} {env:JUNITXML}
110+
pytest {env:PYTEST_PYTHON_FILES} {env:DEBUG} {env:COVERAGE} {env:RERUNS} {env:JUNITXML}
111+
112+
[testenv:doc-{clean,links,html}]
113+
description = Environment for documentation generation
114+
115+
setenv =
116+
SOURCE_DIR = doc/source
117+
BUILD_DIR = doc/build
118+
BUILDER_OPTS = --color -j auto
119+
links: BUILDER = linkcheck
120+
html: BUILDER = html
121+
122+
skip_install =
123+
clean: True
124+
125+
deps =
126+
links,html: -r requirements/requirements_docs.txt
127+
128+
commands_pre =
129+
# Clear any running servers that may be locking resources
130+
html,links: python -c "import psutil; proc_name = 'Ans.Dpf.Grpc'; nb_procs = len([proc.kill() for proc in psutil.process_iter() if proc_name in proc.name()]); \
131+
html,links: print(f'Killed \{nb_procs} \{proc_name} processes.')"
132+
133+
commands =
134+
# Remove previously rendered documentation
135+
clean: python -c "import shutil, sys; shutil.rmtree(sys.argv[1], ignore_errors=True)" "{toxinidir}/{env:BUILD_DIR}"
136+
137+
# Ensure vtk compatibility
138+
html: python -m pip uninstall --yes vtk
139+
html: python -m pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0
140+
141+
# Clean files from previous build
142+
html: python -c "\
143+
html: from os.path import exists; import shutil; \
144+
html: [(shutil.rmtree(p) if exists(p) else None) for p in ['{env:SOURCE_DIR}/images/auto-generated']]; \
145+
html: [(shutil.move(src, dst) if exists(src) else None) for src, dst in \
146+
html: [('{env:SOURCE_DIR}/examples/07-python-operators/plugins', '{env:SOURCE_DIR}/_temp/plugins'), \
147+
html: ('{env:SOURCE_DIR}/examples/04-advanced/02-volume_averaged_stress', '{env:SOURCE_DIR}/_temp/04_advanced'), \
148+
html: ('{env:SOURCE_DIR}/examples/12-fluids/02-fluids_results', '{env:SOURCE_DIR}/_temp/12_fluids')]]; \
149+
html: [shutil.rmtree(p) for p in ['{env:SOURCE_DIR}/examples'] if exists(p)]; \
150+
html: [(shutil.move(src, dst) if exists(src) else None) for src, dst in \
151+
html: [('{env:SOURCE_DIR}/_temp/plugins', '{env:SOURCE_DIR}/examples/07-python-operators/plugins'), \
152+
html: ('{env:SOURCE_DIR}/_temp/04_advanced', '{env:SOURCE_DIR}/examples/04-advanced/02-volume_averaged_stress'), \
153+
html: ('{env:SOURCE_DIR}/_temp/12_fluids', '{env:SOURCE_DIR}/examples/12-fluids/02-fluids_results')]]; \
154+
html: [shutil.rmtree(p) for p in ['{env:SOURCE_DIR}/_temp'] if exists(p)]"
155+
156+
# Build documentation
157+
html,links: sphinx-build -b {env:BUILDER} {env:SOURCE_DIR} {env:BUILD_DIR}/{env:BUILDER} {env:BUILDER_OPTS}
158+
159+
# Patch pyVista issue with elemental plots by copying necessary images
160+
html: python -c "\
161+
html: import os, shutil, glob; os.makedirs('build/html/_images', exist_ok=True); \
162+
html: [(shutil.copy(src, 'build/html/_images') if os.path.exists(src) else print(f'Source not found: {src}')) for src in \
163+
html: glob.glob('{env:SOURCE_DIR}/examples/04-advanced/02-volume_averaged_stress/*') + glob.glob('{env:SOURCE_DIR}/examples/12-fluids/02-fluids_results/*')]"
164+
165+
166+
commands_post =
167+
# Clear any running servers that may be locking resources
168+
html,links: python -c "import psutil; proc_name = 'Ans.Dpf.Grpc'; nb_procs = len([proc.kill() for proc in psutil.process_iter() if proc_name in proc.name()]); \
169+
html,links: print(f'Killed \{nb_procs} \{proc_name} processes.')"
170+
171+
[testenv:build-wheel]
172+
description = Environment for custom build of package wheels
173+
174+
skip_install = True
175+
176+
commands =
177+
python .ci/build_wheel.py -p {posargs:{on_platform}} -w

0 commit comments

Comments
 (0)