Skip to content

Commit 2c7f4bf

Browse files
Simplify library installation (#909)
* Add gate module in src/ansys/dpf/ * remove ansys-dpf-gate from direct dependencies * Add grpc/dpf module to src/ansys/ * remove ansys-grpc-dpf from requirements_dev.txt * Fix assert in test_data_tree.py/test_runtime_core_config * Temporary fix to dpf_mesh_to_vtk_py * By default ignore changes to src/ansys/dpf/gate, ansys/dpf/gatebin and src/ansys/grpc/. This should be overriden when updating using "git add --force my/ignore/file.foo" * Remove requirements_dev.txt with gatebin * Add gatebin for windows directly * Revert "Remove requirements_dev.txt with gatebin" This reverts commit 8b0137d. * Remove gatebin from requirements_dev.txt * Refactor package for single wheel * Add manylinux_1 versions of gatebin binaries * Add grpcio as dependency (was working due to something in requirements_test.txt having it as dependency) * Add google-api-python-client as dependency (was working due to something in requirements_test.txt having it as dependency) * Exclude gate, gatebin and grpc from api-doc generation * Fix title underlines in examples * Update .gitignore * Update .pre-commit-config.yaml * Move everything into src/ansys/dpf/core, also move grpc to src/ansys/dpf/core/grpc/dpf/ * Fix imports due to refactor * Fix imports due to refactor * Add missing refactored files * Fix gate/load_pi.py/_try_use_gatebin() * Fix gate/load_pi.py/_find_outdated_ansys_version() * Add .so gatebin binaries * Fix expected path to gatebin module in test_service.py * Update codacy.yml and .gitignore * Try and fix 02-volume_averaged_stress.py for Docker * Fix 04-extrapolation_stress_3d.py for Docker * Switch to setuptools as backend building tool to allow for several packages in the library * Fix ansys/grpc/dpf instead of ansys/dpf/grpc in ignores * Revert operators/math changes due to testing * Include ansys.dpf.gate.generated in packaged packages * Include all in setup("packages") * Revert changes to 04-extrapolation_stress_3d.py * Add a 10mn timeout to Test API Entry on Docker * Try fix elemental_nodal_to_nodal_fc.outputs[1].type_names * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ as well as ansys_dpf_gate and ansys_dpf_gatebin * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ as well as ansys_dpf_gate and ansys_dpf_gatebin * update_operators.yml now unzips ansys_grpc_dpf in src/ansys/ as well as ansys_dpf_gate and ansys_dpf_gatebin * Improve debugging for operators/build;py * Temp hack to bypass broken operators sweeping_phase specs * Revert "Temp hack to bypass broken operators sweeping_phase specs" This reverts commit bed5415. * Temporarily bypass the mesh_to_vtk operator * Fix use of input standalone-suffix * update operators (#916) Co-authored-by: PProfizi <[email protected]> * Remove previous grpc and gate files and force git add * Still bypass mesh_to_pyvista_op * Bypass bug on plot for 00-compute_and_average.py * Move all metadata to pyproject.toml, keep setup.py for retro-compatibility * Add update_dpf_dependencies.py script * Add update_dpf_dependencies.py script * Remove support for 221 (incompatible with this refactoring of the package) * Updated dpf dependencies * Updated dpf dependencies * Updated dpf dependencies * Updated dpf dependencies * Updated dpf dependencies * Updated dpf dependencies * Add missing generic_data_container_pb2.py and generic_data_container_pb2_grpc.py * Update with latest dist from dpf-standalone * Update with latest dist from dpf-standalone * Remove custom requirements and custom wheels inputs and parameters from CI * Rename ANSYS_DPF_GATE_ROOT -> ANSYSDPFPYGATE_ROOT, ANSYS_DPF_GRPC_ROOT -> DPFDV_ROOT * update operators (#1109) Co-authored-by: PProfizi <[email protected]> * Fix gatebin integration and core.helpers integration * Use branches _integrate_gate for dpf-standalone * Fix test_load_api_without_awp_root_no_gatebin * Fix gate.load_api._try_use_gatebin * Set branch for update_operators.yml to _test_pygate * Update update_dpf_dependencies.py for debug * Update update_dpf_dependencies.py for improved path treatment * Update Operators for DPF 241_test_pygate on maint/integrate_pygate (#1132) * update operators * Update ci.yml --------- Co-authored-by: PProfizi <[email protected]> Co-authored-by: Paul Profizi <[email protected]> * Fix doc step * Make package discovery dynamic * Fix package_data * Fix build_doc.bat fluid images copy * update operators (#1136) Co-authored-by: PProfizi <[email protected]> * Improve update PR text * Set CI back to main dpf-standalone branches --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: PProfizi <[email protected]>
1 parent bf5f83c commit 2c7f4bf

File tree

224 files changed

+34729
-534
lines changed

Some content is hidden

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

224 files changed

+34729
-534
lines changed

.ci/build_doc.bat

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ call sphinx-apidoc -o ../docs/source/api ../src/ansys ../src/ansys/dpf/core/log.
44
../src/ansys/dpf/core/field_base.py ../src/ansys/dpf/core/cache.py ../src/ansys/dpf/core/misc.py ^
55
../src/ansys/dpf/core/check_version.py ../src/ansys/dpf/core/operators/build.py ../src/ansys/dpf/core/operators/specification.py ^
66
../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/core/property_fields_container.py ^
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 ^
89
-f --implicit-namespaces --separate --no-headings
910
pushd .
1011
cd ../docs/
@@ -15,14 +16,14 @@ dir
1516

1617
rem Patch pyVista issue with elemental plots
1718

18-
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images\sphx_glr_02-volume_averaged_stress_001.png /y
19-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images\sphx_glr_02-fluids_results_001.png /y
20-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images\sphx_glr_02-fluids_results_002.png /y
21-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images\sphx_glr_02-fluids_results_003.png /y
22-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images\sphx_glr_02-fluids_results_004.png /y
23-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images\sphx_glr_02-fluids_results_005.png /y
24-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images\sphx_glr_02-fluids_results_006.png /y
25-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images\sphx_glr_02-fluids_results_007.png /y
26-
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images\sphx_glr_02-fluids_results_thumb.png /y
19+
xcopy source\examples\04-advanced\02-volume_averaged_stress\sphx_glr_02-volume_averaged_stress_001.png build\html\_images /y /f /i
20+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_001.png build\html\_images /y /f /i
21+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_002.png build\html\_images /y /f /i
22+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_003.png build\html\_images /y /f /i
23+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_004.png build\html\_images /y /f /i
24+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_005.png build\html\_images /y /f /i
25+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_006.png build\html\_images /y /f /i
26+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_007.png build\html\_images /y /f /i
27+
xcopy source\examples\12-fluids\02-fluids_results\sphx_glr_02-fluids_results_thumb.png build\html\_images /y /f /i
2728

2829
popd

.ci/update_dpf_dependencies.py

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
"""Script to update ansys-dpf-gate, ansys-dpf-gatebin and ansys-grpc-dpf based on repositories
2+
3+
This script should only be used to quickly test changes to any of these dependencies.
4+
Actual commit of updated code should not occur.
5+
The GitHub pipelines take care of the actual update in ansys-dpf-core.
6+
7+
Define environment variables to know where to get the code from:
8+
- "DPFDV_ROOT" defines the DPF repo where ansys-grpc-dpf resides.
9+
Will unzip the latest wheel built in DPF/proto/dist/.
10+
- "ANSYSDPFPYGATE_ROOT" defines where the ansys-dpf-pygate repository resides.
11+
12+
It will update the current repo
13+
or the repo defined by the environment variable "ANSYSDPFCORE_ROOT" if it exists.
14+
"""
15+
import os
16+
import glob
17+
import pathlib
18+
import platform
19+
import shutil
20+
import zipfile
21+
22+
23+
grpc_path_key = "DPFDV_ROOT"
24+
gate_path_key = "ANSYSDPFPYGATE_ROOT"
25+
core_path = pathlib.Path(__file__).parent.parent.resolve()
26+
if "ANSYSDPFCORE_ROOT" in os.environ:
27+
core_path = os.environ["ANSYSDPFCORE_ROOT"]
28+
29+
grpc_path = os.getenv(grpc_path_key, None)
30+
gate_path = os.getenv(gate_path_key, None)
31+
32+
if grpc_path is not None:
33+
# Update ansys-grpc-dpf with latest in proto/dist
34+
print("Updating ansys.grpc.dpf")
35+
dist_path = os.path.join(grpc_path, "proto", "dist", "*")
36+
print(f"from {dist_path}")
37+
destination = os.path.join(core_path, "src")
38+
print(f"into {destination}")
39+
latest_wheel = max(glob.glob(dist_path), key=os.path.getctime)
40+
with zipfile.ZipFile(latest_wheel, 'r') as wheel:
41+
for file in wheel.namelist():
42+
# print(file)
43+
if file.startswith('ansys/'):
44+
wheel.extract(
45+
file,
46+
path=destination,
47+
)
48+
print("Done updating ansys-grpc-dpf")
49+
else:
50+
print(f"{grpc_path_key} environment variable is not defined. "
51+
"Cannot update ansys-grpc-dpf.")
52+
53+
if gate_path is not None:
54+
# Update ansys-dpf-gate
55+
print("Updating ansys.dpf.gate")
56+
dist_path = os.path.join(gate_path, "ansys-dpf-gate", "ansys")
57+
print(f"from {dist_path}")
58+
destination = os.path.join(core_path, "src", "ansys")
59+
print(f"into {destination}")
60+
shutil.copytree(
61+
src=dist_path,
62+
dst=destination,
63+
dirs_exist_ok=True,
64+
ignore=lambda directory, contents: ["__pycache__"] if directory[-5:] == "gate" else [],
65+
)
66+
print("Done updating ansys-dpf-gate")
67+
68+
# Update ansys-dpf-gatebin
69+
print("Updating ansys.dpf.gatebin")
70+
dist_path = os.path.join(gate_path, "ansys-dpf-gatebin", "ansys")
71+
print(f"from {dist_path}")
72+
destination = os.path.join(core_path, "src", "ansys")
73+
print(f"into {destination}")
74+
shutil.copytree(
75+
src=dist_path,
76+
dst=destination,
77+
dirs_exist_ok=True,
78+
)
79+
print(f"Done updating ansys-dpf-gatebin for {platform.system()}")
80+
else:
81+
print(f"{gate_path_key} environment variable is not defined. "
82+
"Cannot update ansys-dpf-gate or ansys-dpf-gatebin.")

.flake8

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[flake8]
2-
exclude = venv, src/ansys/dpf/core/operators, __init__.py, docs/build, .venv
2+
exclude = venv, src/ansys/dpf/core/operators, __init__.py, docs/build, .venv, src/ansys/dpf/gate, src/ansys/dpf/gatebin, src/ansys/grpc/dpf
33
select = W191, W391, E115, E117, E122, E124, E125, E301, W291, W293, E225, E231, E303, E501, F401, F403
4-
per-file-ignores = __init__.py:F401,F403
4+
per-file-ignores =
5+
__init__.py:F401,F403
56
count = True
67
max-complexity = 10
78
max-line-length = 100

.github/workflows/ci.yml

-41
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ on:
1414
description: 'Suffix of the branch on standalone'
1515
required: false
1616
default: ''
17-
custom-requirements:
18-
description: "Path to requirements.txt file to install"
19-
required: false
20-
type: string
21-
default: 'requirements/requirements_dev.txt'
22-
custom-wheels:
23-
description: "extra pip --find-links argument to find custom dpf wheels"
24-
required: false
25-
type: string
26-
default: './dpf-standalone/v241/dist'
27-
custom-wheels-docker:
28-
description: "extra pip --find-links argument to find custom dpf wheels"
29-
required: false
30-
type: string
31-
default: './dpf-standalone/dist'
3217

3318

3419
concurrency:
@@ -73,8 +58,6 @@ jobs:
7358
wheel: true
7459
wheelhouse: false
7560
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
76-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
77-
custom-wheels: ${{ github.event.inputs.custom-wheels || './dpf-standalone/v241/dist' }}
7861
secrets: inherit
7962

8063
docker_tests:
@@ -83,8 +66,6 @@ jobs:
8366
with:
8467
ANSYS_VERSION: "241"
8568
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
86-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
87-
custom-wheels: ${{ github.event.inputs.custom-wheels-docker || './dpf-standalone/dist' }}
8869
secrets: inherit
8970

9071
docker_examples:
@@ -94,8 +75,6 @@ jobs:
9475
ANSYS_VERSION: "241"
9576
python_versions: '["3.8"]'
9677
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
97-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
98-
custom-wheels: ${{ github.event.inputs.custom-wheels-docker || './dpf-standalone/dist' }}
9978
secrets: inherit
10079

10180
docs:
@@ -104,8 +83,6 @@ jobs:
10483
with:
10584
ANSYS_VERSION: "241"
10685
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
107-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
108-
custom-wheels: ${{ github.event.inputs.custom-wheels || './dpf-standalone/v241/dist' }}
10986
event_name: ${{ github.event_name }}
11087
secrets: inherit
11188

@@ -129,8 +106,6 @@ jobs:
129106
ANSYS_VERSION: "241"
130107
python_versions: '["3.8"]'
131108
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
132-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
133-
custom-wheels: ${{ github.event.inputs.custom-wheels || './dpf-standalone/v241/dist' }}
134109
secrets: inherit
135110

136111
retro_232:
@@ -142,7 +117,6 @@ jobs:
142117
python_versions: '["3.8"]'
143118
DOCSTRING: false
144119
standalone_suffix: ''
145-
custom-wheels: './dpf-standalone/v232/dist --pre'
146120
secrets: inherit
147121

148122
retro_231:
@@ -153,7 +127,6 @@ jobs:
153127
ANSYS_VERSION: "231"
154128
python_versions: '["3.8"]'
155129
DOCSTRING: false
156-
custom-wheels: './.github'
157130
secrets: inherit
158131

159132
retro_222:
@@ -164,18 +137,6 @@ jobs:
164137
ANSYS_VERSION: "222"
165138
python_versions: '["3.8"]'
166139
DOCSTRING: false
167-
custom-wheels: './.github'
168-
secrets: inherit
169-
170-
retro_221:
171-
name: "retro 221"
172-
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
173-
uses: ./.github/workflows/tests.yml
174-
with:
175-
ANSYS_VERSION: "221"
176-
python_versions: '["3.8"]'
177-
DOCSTRING: false
178-
custom-wheels: './.github'
179140
secrets: inherit
180141

181142
pydpf-post:
@@ -186,7 +147,5 @@ jobs:
186147
ANSYS_VERSION: "241"
187148
post_branch: "master"
188149
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
189-
custom-requirements: ${{ github.event.inputs.custom-requirements || 'requirements/requirements_dev.txt' }}
190-
custom-wheels: ${{ github.event.inputs.custom-wheels || './dpf-standalone/v241/dist' }}
191150
test_docstrings: "true"
192151
secrets: inherit

.github/workflows/ci_release.yml

+1-17
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,6 @@ jobs:
107107
DOCSTRING: false
108108
secrets: inherit
109109

110-
retro_221:
111-
name: "retro 221"
112-
uses: ./.github/workflows/tests.yml
113-
with:
114-
ANSYS_VERSION: "221"
115-
python_versions: '["3.8"]'
116-
DOCSTRING: false
117-
secrets: inherit
118-
119110
pydpf-post_241:
120111
name: "PyDPF-Post with 241"
121112
uses: ./.github/workflows/pydpf-post.yml
@@ -146,13 +137,6 @@ jobs:
146137
ANSYS_VERSION: "222"
147138
secrets: inherit
148139

149-
pydpf-post_221:
150-
name: "PyDPF-Post with 221"
151-
uses: ./.github/workflows/pydpf-post.yml
152-
with:
153-
ANSYS_VERSION: "221"
154-
secrets: inherit
155-
156140
gate:
157141
name: "gate"
158142
uses: ./.github/workflows/gate.yml
@@ -182,7 +166,7 @@ jobs:
182166
draft_release:
183167
name: "Draft Release"
184168
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
185-
needs: [style, tests, docs, examples, retro_232, retro_231, retro_222, retro_221, gate, docker_tests]
169+
needs: [style, tests, docs, examples, retro_232, retro_231, retro_222, gate, docker_tests]
186170
runs-on: ubuntu-latest
187171
steps:
188172
- name: "Download artifacts"

.github/workflows/docs.yml

-22
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ on:
1717
required: false
1818
type: string
1919
default: ''
20-
custom-requirements:
21-
description: "Path to requirements.txt file to install"
22-
required: false
23-
type: string
24-
default: ''
25-
custom-wheels:
26-
description: "extra pip '--find-links XXX' argument to find custom dpf wheels"
27-
required: false
28-
type: string
29-
default: ''
3020
event_name:
3121
description: "Name of event calling"
3222
required: true
@@ -50,16 +40,6 @@ on:
5040
required: false
5141
type: string
5242
default: ''
53-
custom-requirements:
54-
description: "Path to requirements.txt file to install"
55-
required: false
56-
type: string
57-
default: ''
58-
custom-wheels:
59-
description: "extra pip --find-links argument to find custom dpf wheels"
60-
required: false
61-
type: string
62-
default: ''
6343

6444
env:
6545
PACKAGE_NAME: ansys-dpf-core
@@ -103,9 +83,7 @@ jobs:
10383
install_extras: plotting
10484
wheel: false
10585
wheelhouse: false
106-
extra-pip-args: ${{ inputs.custom-wheels && format('--find-links {0}', inputs.custom-wheels) || '' }}
10786
standalone_suffix: ${{ inputs.standalone_suffix }}
108-
custom-requirements: ${{ inputs.custom-requirements }}
10987

11088
- name: "Setup headless display"
11189
uses: pyvista/setup-headless-display-action@v1

.github/workflows/examples.yml

-22
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ on:
1717
required: false
1818
type: string
1919
default: ''
20-
custom-requirements:
21-
description: "Path to requirements.txt file to install"
22-
required: false
23-
type: string
24-
default: ''
25-
custom-wheels:
26-
description: "extra pip --find-links argument to find custom dpf wheels"
27-
required: false
28-
type: string
29-
default: ''
3020
# Can be called manually
3121
workflow_dispatch:
3222
inputs:
@@ -45,16 +35,6 @@ on:
4535
required: false
4636
type: string
4737
default: ''
48-
custom-requirements:
49-
description: "Path to requirements.txt file to install"
50-
required: false
51-
type: string
52-
default: ''
53-
custom-wheels:
54-
description: "extra pip --find-links argument to find custom dpf wheels"
55-
required: false
56-
type: string
57-
default: ''
5838

5939
env:
6040
PACKAGE_NAME: ansys-dpf-core
@@ -107,9 +87,7 @@ jobs:
10787
install_extras: plotting
10888
wheelhouse: false
10989
wheel: false
110-
extra-pip-args: ${{ inputs.custom-wheels && format('--find-links {0}', inputs.custom-wheels) || '' }}
11190
standalone_suffix: ${{ inputs.standalone_suffix }}
112-
custom-requirements: ${{ inputs.custom-requirements }}
11391

11492
- name: "Prepare Testing Environment"
11593
uses: ansys/pydpf-actions/[email protected]

0 commit comments

Comments
 (0)