Skip to content

Commit 23d005d

Browse files
authored
Merge branch 'master' into dependabot/pip/requirements/sphinx-8.1.3
2 parents 9bb195f + 775d101 commit 23d005d

File tree

1,075 files changed

+22897
-3950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,075 files changed

+22897
-3950
lines changed

.ci/build_doc.bat

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
set SPHINX_APIDOC_OPTIONS=inherited-members
2-
call sphinx-apidoc -o ../doc/source/api ../src/ansys ../src/ansys/dpf/core/log.py ^
3-
../src/ansys/dpf/core/help.py ../src/ansys/dpf/core/mapping_types.py ../src/ansys/dpf/core/ipconfig.py ^
4-
../src/ansys/dpf/core/field_base.py ../src/ansys/dpf/core/cache.py ../src/ansys/dpf/core/misc.py ^
5-
../src/ansys/dpf/core/check_version.py ../src/ansys/dpf/core/operators/build.py ../src/ansys/dpf/core/operators/specification.py ^
6-
../src/ansys/dpf/core/vtk_helper.py ../src/ansys/dpf/core/label_space.py ../src/ansys/dpf/core/examples/python_plugins/* ^
7-
../src/ansys/dpf/core/examples/examples.py ../src/ansys/dpf/gate/* ../src/ansys/dpf/gatebin/* ../src/ansys/grpc/dpf/* ^
8-
../src/ansys/dpf/core/property_fields_container.py ^
9-
-f --implicit-namespaces --separate --no-headings
1+
@echo off
2+
3+
REM Move to the documentation directory
104
pushd .
115
cd ../doc/
6+
7+
REM Clean the previous build
128
call make clean
9+
10+
REM Build the HTML documentation
1311
call make html -v -v -v -P
1412

13+
REM Display the directory contents for verification
1514
dir
1615

17-
rem Patch pyVista issue with elemental plots
16+
REM Patch pyVista issue with elemental plots by copying necessary images
17+
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images\ /y /f
18+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images\ /y /f
19+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images\ /y /f
20+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images\ /y /f
21+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images\ /y /f
22+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images\ /y /f
23+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images\ /y /f
24+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images\ /y /f
25+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images\ /y /f
1826

19-
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images\ /y /f
20-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images\ /y /f
21-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images\ /y /f
22-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images\ /y /f
23-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images\ /y /f
24-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images\ /y /f
25-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images\ /y /f
26-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images\ /y /f
27-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images\ /y /f
27+
REM Return to the original directory
2828
popd

.ci/build_wheel.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22
# Input can be one of ["any", "win", "manylinux1", "manylinux_2_17"]
33

44
import argparse
5-
import subprocess
65
import os
7-
import sys
6+
from pathlib import Path
87
import shutil
8+
import subprocess
9+
import sys
910
import tempfile
1011

11-
1212
supported_platforms = {
1313
"any": "any",
1414
"win": "win_amd64",
1515
"manylinux1": "manylinux1_x86_64",
1616
"manylinux_2_17": "manylinux_2_17_x86_64",
17+
# Accommodate tox.ini automatic platform substitutions
18+
"linux": "manylinux_2_17_x86_64",
19+
"win32": "win_amd64",
20+
"darwin": "any",
1721
}
1822

1923
argParser = argparse.ArgumentParser()
@@ -39,15 +43,13 @@
3943
print("Created temporary directory: ", tmpdirname)
4044

4145
# Create the temporary build-opts.cfg
42-
build_opts_path = os.path.join(tmpdirname, "build-opts.cfg")
43-
with open(build_opts_path, "w") as build_opts_file:
44-
build_opts_file.write(f"[bdist_wheel]\nplat-name={requested_platform}")
45-
os.environ["DIST_EXTRA_CONFIG"] = build_opts_path
46+
build_opts_path = Path(tmpdirname) / "build-opts.cfg"
47+
48+
build_opts_path.write_text(f"[bdist_wheel]\nplat-name={requested_platform}", encoding="utf-8")
49+
os.environ["DIST_EXTRA_CONFIG"] = str(build_opts_path)
4650

4751
# Move the binaries
48-
gatebin_folder_path = os.path.join(
49-
os.path.curdir, os.path.join("src", "ansys", "dpf", "gatebin")
50-
)
52+
gatebin_folder_path = Path.cwd() / "src" / "ansys" / "dpf" / "gatebin"
5153
binaries_to_move = []
5254
moved = []
5355
if "win" in requested_platform or "any" == requested_platform:
@@ -60,15 +62,15 @@
6062
binaries_to_move.extend(["_version.py"])
6163

6264
for binary_name in binaries_to_move:
63-
src = os.path.join(gatebin_folder_path, binary_name)
64-
dst = os.path.join(tmpdirname, binary_name)
65+
src = gatebin_folder_path / binary_name
66+
dst = Path(tmpdirname) / binary_name
6567
print(f"Moving {src} to {dst}")
6668
shutil.move(src=src, dst=dst)
6769
moved.append([dst, src])
6870

6971
if "any" == requested_platform:
7072
# Also remove the gatebin folder
71-
os.rmdir(gatebin_folder_path)
73+
gatebin_folder_path.rmdir()
7274

7375
# Call the build
7476
if not args.wheelhouse:
@@ -83,7 +85,7 @@
8385

8486
if "any" == requested_platform:
8587
# Recreate the gatebin folder
86-
os.mkdir(gatebin_folder_path)
88+
gatebin_folder_path.mkdir()
8789

8890
# Move binaries back
8991
for move_back in moved:

.ci/code_generation.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# import subprocess
22

3-
from ansys.dpf import core
4-
from ansys.dpf.core.operators import build
5-
import os
63
import glob
4+
import os
75
from pathlib import Path
86
import shutil
97

8+
from ansys.dpf import core
9+
from ansys.dpf.core.operators import build
1010

11-
local_dir = os.path.dirname(os.path.abspath(__file__))
12-
TARGET_PATH = os.path.join(local_dir, os.pardir, "src", "ansys", "dpf", "core", "operators")
13-
files = glob.glob(os.path.join(TARGET_PATH, "*"))
14-
for f in files:
15-
if Path(f).stem == "specification":
11+
local_dir = Path(__file__).parent
12+
TARGET_PATH = local_dir.parent / "src" / "ansys" / "dpf" / "core" / "operators"
13+
files = TARGET_PATH.glob("*")
14+
for file_path in files:
15+
if file_path.stem == "specification":
1616
continue
17-
if Path(f).name == "build.py":
17+
if file_path.name == "build.py":
1818
continue
19-
if Path(f).name == "operator.mustache":
19+
if file_path.name == "operator.mustache":
2020
continue
2121
try:
22-
if os.path.isdir(f):
23-
shutil.rmtree(f)
22+
if file_path.is_dir():
23+
shutil.rmtree(file_path)
2424
else:
25-
os.remove(f)
25+
file_path.unlink()
2626
except:
2727
pass
2828

.ci/run_examples.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import os
21
import glob
3-
import pathlib
2+
import os
3+
from pathlib import Path
44
import subprocess
55
import sys
66

77
import ansys.dpf.core as dpf
88
from ansys.dpf.core.examples import get_example_required_minimum_dpf_version
99

10-
1110
os.environ["PYVISTA_OFF_SCREEN"] = "true"
1211
os.environ["MPLBACKEND"] = "Agg"
1312

14-
actual_path = pathlib.Path(__file__).parent.absolute()
15-
print(os.path.join(actual_path, os.path.pardir, "examples"))
13+
actual_path = Path(__file__).parent.absolute()
14+
examples_path = actual_path.parent / "examples"
15+
print(examples_path)
1616

1717
# Get the DPF server version
1818
server = dpf.server.get_or_create_server(None)
1919
server_version = server.version
2020
server.shutdown()
2121
print(f"Server version: {server_version}")
2222

23-
for root, subdirectories, files in os.walk(os.path.join(actual_path, os.path.pardir, "examples")):
23+
for root, subdirectories, files in os.walk(examples_path):
2424
for subdirectory in subdirectories:
25-
subdir = os.path.join(root, subdirectory)
26-
for file in glob.iglob(os.path.join(subdir, "*.py")):
27-
if sys.platform == "linux" and "08-python-operators" in file:
25+
subdir = Path(root) / subdirectory
26+
for file in subdir.glob("*.py"):
27+
if sys.platform == "linux" and "08-python-operators" in str(file):
2828
continue
29-
elif "win" in sys.platform and "06-distributed_stress_averaging" in file:
29+
elif "win" in sys.platform and "06-distributed_stress_averaging" in str(file):
3030
# Currently very unstable in the GH CI
3131
continue
3232
print("\n--------------------------------------------------")
@@ -36,7 +36,7 @@
3636
print(f"Example skipped as it requires DPF {minimum_version_str}.", flush=True)
3737
continue
3838
try:
39-
out = subprocess.check_output([sys.executable, file])
39+
out = subprocess.check_output([sys.executable, str(file)])
4040
except subprocess.CalledProcessError as e:
4141
sys.stderr.write(str(e.args))
4242
if e.returncode != 3221225477:

.ci/run_non_regression_examples.py

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,39 @@
1-
import os
21
import glob
3-
from ansys.dpf import core
2+
import os
43
import pathlib
54
import subprocess
65
import sys
76

7+
from ansys.dpf import core
8+
89
os.environ["PYVISTA_OFF_SCREEN"] = "true"
910
os.environ["MPLBACKEND"] = "Agg"
1011

1112
actual_path = pathlib.Path(__file__).parent.absolute()
12-
print(os.path.join(actual_path, os.path.pardir, "examples"))
13+
examples_path = actual_path.parent / "examples"
14+
print(examples_path)
1315

1416

1517
list_tests = [
16-
os.path.join(actual_path, os.path.pardir, "examples", "00-basic"),
17-
os.path.join(actual_path, os.path.pardir, "examples", "01-transient_analyses"),
18-
os.path.join(actual_path, os.path.pardir, "examples", "02-modal_analyses"),
19-
os.path.join(actual_path, os.path.pardir, "examples", "03-harmonic_analyses"),
20-
os.path.join(actual_path, os.path.pardir, "examples", "06-plotting", "00-basic_plotting.py"),
21-
os.path.join(
22-
actual_path,
23-
os.path.pardir,
24-
"examples",
25-
"06-plotting",
26-
"05-plot_on_warped_mesh.py",
27-
),
28-
os.path.join(
29-
actual_path,
30-
os.path.pardir,
31-
"examples",
32-
"07-distributed-post",
33-
"00-distributed_total_disp.py",
34-
),
18+
examples_path / "00-basic",
19+
examples_path / "01-transient_analyses",
20+
examples_path / "02-modal_analyses",
21+
examples_path / "03-harmonic_analyses",
22+
examples_path / "06-plotting" / "00-basic_plotting.py",
23+
examples_path / "06-plotting" / "05-plot_on_warped_mesh.py",
24+
examples_path / "07-distributed-post" / "00-distributed_total_disp.py",
3525
]
3626

3727
if core.SERVER_CONFIGURATION != core.AvailableServerConfigs.InProcessServer:
38-
list_tests.append(
39-
os.path.join(
40-
actual_path,
41-
os.path.pardir,
42-
"examples",
43-
"08-python-operators",
44-
"00-wrapping_numpy_capabilities.py",
45-
)
46-
)
28+
list_tests.append(examples_path / "08-python-operators" / "00-wrapping_numpy_capabilities.py")
4729

4830
for path in list_tests:
49-
if os.path.isdir(path):
50-
for file in glob.iglob(os.path.join(path, "*.py")):
31+
if path.is_dir():
32+
for file in path.glob("*.py"):
5133
print("\n--------------------------------------------------")
5234
print(file)
5335
try:
54-
subprocess.check_call([sys.executable, file])
36+
subprocess.check_call([sys.executable, str(file)])
5537
except subprocess.CalledProcessError as e:
5638
sys.stderr.write(str(e.args))
5739
if e.returncode != 3221225477:
@@ -61,7 +43,7 @@
6143
print("\n--------------------------------------------------")
6244
print(path)
6345
try:
64-
subprocess.check_call([sys.executable, file])
46+
subprocess.check_call([sys.executable, str(file)])
6547
except subprocess.CalledProcessError as e:
6648
sys.stderr.write(str(e.args))
6749
if e.returncode != 3221225477:

.ci/update_dpf_dependencies.py

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,30 @@
1313
or the repo defined by the environment variable "ANSYSDPFCORE_ROOT" if it exists.
1414
"""
1515

16-
import os
1716
import glob
18-
import pathlib
17+
import os
18+
from pathlib import Path
1919
import platform
2020
import shutil
2121
import zipfile
2222

23-
2423
grpc_path_key = "DPFDV_ROOT"
2524
gate_path_key = "ANSYSDPFPYGATE_ROOT"
26-
core_path = pathlib.Path(__file__).parent.parent.resolve()
25+
core_path = Path(__file__).parent.parent
2726
if "ANSYSDPFCORE_ROOT" in os.environ:
2827
core_path = os.environ["ANSYSDPFCORE_ROOT"]
2928

3029
grpc_path = os.getenv(grpc_path_key, None)
3130
gate_path = os.getenv(gate_path_key, None)
3231

33-
if grpc_path is not None:
32+
if grpc_path:
3433
# Update ansys-grpc-dpf with latest in proto/dist
3534
print("Updating ansys.grpc.dpf")
36-
dist_path = os.path.join(grpc_path, "proto", "dist", "*")
35+
dist_path = Path(grpc_path) / "proto" / "dist"
3736
print(f"from {dist_path}")
38-
destination = os.path.join(core_path, "src")
37+
destination = Path(core_path) / "src"
3938
print(f"into {destination}")
40-
latest_wheel = max(glob.glob(dist_path), key=os.path.getctime)
39+
latest_wheel = max(dist_path.glob("*"), key=os.path.getctime)
4140
with zipfile.ZipFile(latest_wheel, "r") as wheel:
4241
for file in wheel.namelist():
4342
# print(file)
@@ -50,40 +49,34 @@
5049
else:
5150
print(f"{grpc_path_key} environment variable is not defined. " "Cannot update ansys-grpc-dpf.")
5251

53-
if gate_path is not None:
52+
if gate_path:
5453
# Update ansys-dpf-gate
5554
print("Updating ansys.dpf.gate generated code")
56-
dist_path = os.path.join(gate_path, "ansys-dpf-gate", "ansys", "dpf", "gate", "generated")
55+
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "generated"
5756
print(f"from {dist_path}")
58-
destination = os.path.join(core_path, "src", "ansys", "dpf", "gate", "generated")
57+
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "generated"
5958
print(f"into {destination}")
6059
shutil.copytree(
6160
src=dist_path,
6261
dst=destination,
6362
dirs_exist_ok=True,
64-
ignore=lambda directory, contents: ["__pycache__"] if directory[-5:] == "gate" else [],
63+
ignore=lambda directory, contents: ["__pycache__"] if str(directory)[-5:] == "gate" else [],
6564
)
66-
dist_path = os.path.join(gate_path, "ansys-dpf-gate", "ansys", "dpf", "gate", "__init__.py")
65+
66+
dist_path = Path(gate_path) / "ansys-dpf-gate" / "ansys" / "dpf" / "gate" / "__init__.py"
6767
print(f"from {dist_path}")
68-
destination = os.path.join(core_path, "src", "ansys", "dpf", "gate", "__init__.py")
68+
destination = Path(core_path) / "src" / "ansys" / "dpf" / "gate" / "__init__.py"
6969
print(f"into {destination}")
70-
shutil.copy(
71-
src=dist_path,
72-
dst=destination,
73-
)
70+
shutil.copy(src=dist_path, dst=destination)
7471
print("Done updating ansys.dpf.gate generated code")
7572

7673
# Update ansys-dpf-gatebin
7774
print("Updating ansys.dpf.gatebin")
78-
dist_path = os.path.join(gate_path, "ansys-dpf-gatebin", "ansys")
75+
dist_path = Path(gate_path) / "ansys-dpf-gatebin" / "ansys"
7976
print(f"from {dist_path}")
80-
destination = os.path.join(core_path, "src", "ansys")
77+
destination = Path(core_path) / "src" / "ansys"
8178
print(f"into {destination}")
82-
shutil.copytree(
83-
src=dist_path,
84-
dst=destination,
85-
dirs_exist_ok=True,
86-
)
79+
shutil.copytree(src=dist_path, dst=destination, dirs_exist_ok=True)
8780
print(f"Done updating ansys.dpf.gatebin for {platform.system()}")
8881
else:
8982
print(

0 commit comments

Comments
 (0)