Skip to content

Commit e2cbd64

Browse files
committed
Merge branch 'main' into release/0.3
2 parents 3df28ea + 5ef7f1c commit e2cbd64

Some content is hidden

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

54 files changed

+489
-326
lines changed

.github/workflows/ci_cd.yml

Lines changed: 147 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,16 @@ env:
1717
ANSRV_GEO_PORT: 700
1818
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
1919
GEO_CONT_NAME: ans_geo
20-
RESET_IMAGE_CACHE: 2
20+
RESET_IMAGE_CACHE: 3
2121
IS_WORKFLOW_RUNNING: True
22+
ARTIFACTORY_VERSION: v241
2223

2324
concurrency:
2425
group: ${{ github.workflow }}-${{ github.ref }}
2526
cancel-in-progress: true
2627

2728
jobs:
2829

29-
style:
30-
name: Code style
31-
runs-on: ubuntu-latest
32-
steps:
33-
- name: PyAnsys code style checks
34-
uses: ansys/actions/code-style@v4
35-
with:
36-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
37-
3830
docs-style:
3931
name: Documentation Style Check
4032
runs-on: ubuntu-latest
@@ -47,7 +39,6 @@ jobs:
4739
smoke-tests:
4840
name: Build and Smoke tests
4941
runs-on: ${{ matrix.os }}
50-
needs: [style]
5142
strategy:
5243
fail-fast: false
5344
matrix:
@@ -214,7 +205,7 @@ jobs:
214205
pip install --upgrade build wheel
215206
pip install .[doc]
216207
# TODO - To be removed once it is published
217-
pip uninstall sphinx-autoapi
208+
pip uninstall --yes sphinx-autoapi
218209
pip install "sphinx-autoapi @ git+https://github.com/jorgepiloto/sphinx-autoapi@feat/single-page-option"
219210
220211
- name: Login to GitHub Container Registry
@@ -363,6 +354,10 @@ jobs:
363354
library-name: ${{ env.PACKAGE_NAME }}
364355
python-version: ${{ env.MAIN_PYTHON_VERSION }}
365356

357+
# =================================================================================================
358+
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
359+
# =================================================================================================
360+
366361
fetch-release-artifacts:
367362
name: Fetch release artifacts
368363
needs: [testing-windows, testing-linux, docs]
@@ -374,8 +369,8 @@ jobs:
374369
steps:
375370
- name: Download binaries
376371
run: |
377-
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerWindows.zip --output windows-binaries.zip
378-
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerLinux.zip --output linux-binaries.zip
372+
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerWindows.zip --output windows-binaries.zip
373+
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerLinux.zip --output linux-binaries.zip
379374
380375
- name: Upload Windows binaries as workflow artifacts
381376
uses: actions/upload-artifact@v3
@@ -391,10 +386,147 @@ jobs:
391386
path: linux-binaries.zip
392387
retention-days: 7
393388

389+
build-windows-container:
390+
name: Building Geometry Service - Windows
391+
runs-on: [self-hosted, Windows, pygeometry]
392+
needs: [fetch-release-artifacts]
393+
steps:
394+
- name: Checkout repository
395+
uses: actions/checkout@v4
396+
397+
- name: Set up Python
398+
uses: actions/setup-python@v4
399+
with:
400+
python-version: '3.9' # use python3.9, self-hosted has an issue with 3.10
401+
402+
- name: Download Windows binaries
403+
uses: actions/download-artifact@v3
404+
with:
405+
name: windows-binaries.zip
406+
path: docker/windows-binaries.zip
407+
408+
- name: Build Docker image
409+
working-directory: docker
410+
run: |
411+
docker build -f Dockerfile.windows -t ghcr.io/ansys/geometry:windows-latest-tmp .
412+
413+
- name: Check location of self-hosted runner and define license server accordingly
414+
if: runner.name == 'pygeometry-ci-1' || runner.name == 'pygeometry-ci-2'
415+
run:
416+
echo "ANSRV_GEO_LICENSE_SERVER=${{ secrets.INTERNAL_LICENSE_SERVER }}" | Out-File -FilePath $env:GITHUB_ENV -Append
417+
418+
- name: Launch Geometry service
419+
run: |
420+
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:windows-latest-tmp
421+
422+
- name: Validate connection using PyAnsys Geometry
423+
run: |
424+
python -m venv .venv
425+
.\.venv\Scripts\Activate.ps1
426+
python -m pip install --upgrade pip
427+
pip install -e .[tests]
428+
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
429+
430+
- name: Restore images cache
431+
uses: actions/cache@v3
432+
with:
433+
path: .\tests\integration\image_cache
434+
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
435+
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
436+
437+
- name: Testing
438+
run: |
439+
.\.venv\Scripts\Activate.ps1
440+
pytest -v --use-existing-service=yes
441+
442+
- name: Stop the Geometry service
443+
if: always()
444+
run: |
445+
docker stop ${{ env.GEO_CONT_NAME }}
446+
docker logs ${{ env.GEO_CONT_NAME }}
447+
docker rm ${{ env.GEO_CONT_NAME }}
448+
449+
- name: Stop any remaining containers
450+
if: always()
451+
run: |
452+
$dockerContainers = docker ps -a -q
453+
if (-not [string]::IsNullOrEmpty($dockerContainers)) {
454+
docker stop $dockerContainers
455+
docker rm $dockerContainers
456+
}
457+
458+
- name: Delete the Docker images (and untagged ones)
459+
if: always()
460+
run: |
461+
docker image rm ghcr.io/ansys/geometry:windows-latest-tmp
462+
docker system prune -f
463+
464+
# =================================================================================================
465+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
466+
# =================================================================================================
467+
468+
build-linux-container:
469+
name: Building Geometry Service - Linux
470+
runs-on: ubuntu-latest
471+
needs: [fetch-release-artifacts]
472+
steps:
473+
- name: Checkout repository
474+
uses: actions/checkout@v4
475+
476+
- name: Set up Python
477+
uses: actions/setup-python@v4
478+
with:
479+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
480+
481+
- name: Download Linux binaries
482+
uses: actions/download-artifact@v3
483+
with:
484+
name: linux-binaries.zip
485+
path: docker/linux-binaries.zip
486+
487+
- name: Build Docker image
488+
working-directory: docker
489+
run: |
490+
docker build -f Dockerfile.linux -t ghcr.io/ansys/geometry:linux-latest-tmp .
491+
492+
- name: Launch Geometry service
493+
run: |
494+
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:linux-latest-tmp
495+
496+
- name: Validate connection using PyAnsys Geometry
497+
run: |
498+
python -m pip install --upgrade pip
499+
pip install -e .[tests]
500+
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
501+
502+
- name: Restore images cache
503+
uses: actions/cache@v3
504+
with:
505+
path: .\tests\integration\image_cache
506+
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
507+
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
508+
509+
- name: Run pytest
510+
uses: ansys/actions/tests-pytest@v4
511+
env:
512+
ALLOW_PLOTTING: true
513+
with:
514+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
515+
pytest-extra-args: "--service-os=linux --use-existing-service=yes"
516+
checkout: false
517+
requires-xvfb: true
518+
519+
- name: Stop the Geometry service
520+
if: always()
521+
run: |
522+
docker stop ${{ env.GEO_CONT_NAME }}
523+
docker logs ${{ env.GEO_CONT_NAME }}
524+
docker rm ${{ env.GEO_CONT_NAME }}
525+
394526
release:
395527
name: Release project
396528
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
397-
needs: [package, fetch-release-artifacts]
529+
needs: [package, build-windows-container, build-linux-container]
398530
runs-on: ubuntu-latest
399531
steps:
400532
- name: Release to the public PyPI repository

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PyAnsys Geometry
22
================
3-
|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black|
3+
|pyansys| |python| |pypi| |GH-CI| |codecov| |MIT| |black| |pre-commit|
44

55
.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
66
:target: https://docs.pyansys.com/
@@ -30,6 +30,9 @@ PyAnsys Geometry
3030
:target: https://github.com/psf/black
3131
:alt: Black
3232

33+
.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pyansys-geometry/main.svg
34+
:target: https://results.pre-commit.ci/latest/github/ansys/pyansys-geometry/main
35+
:alt: pre-commit.ci
3336

3437
PyAnsys Geometry is a Python client library for the Ansys Geometry service.
3538

doc/make.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ REM Command file for Sphinx documentation
77
if "%SPHINXBUILD%" == "" (
88
set SPHINXBUILD=sphinx-build
99
)
10+
if "%SPHINXOPTS%" == "" (
11+
set SPHINXOPTS=-j auto -W --color
12+
)
1013
set SOURCEDIR=source
1114
set BUILDDIR=_build
1215

doc/source/conf.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@
7979
# Intersphinx mapping
8080
intersphinx_mapping = {
8181
"python": ("https://docs.python.org/3", None),
82-
"pint": ("https://pint.readthedocs.io/en/stable", None),
83-
"numpy": ("https://numpy.org/devdocs", None),
82+
"numpy": ("https://numpy.org/doc/stable", None),
8483
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
85-
"pyvista": ("https://docs.pyvista.org/", None),
84+
"pyvista": ("https://docs.pyvista.org/version/stable", None),
8685
"grpc": ("https://grpc.github.io/grpc/python/", None),
87-
# kept here as an example
88-
# "matplotlib": ("https://matplotlib.org/stable", None),
89-
"pypim": ("https://pypim.docs.pyansys.com/version/dev", None),
86+
"pint": ("https://pint.readthedocs.io/en/stable", None),
87+
"beartype": ("https://beartype.readthedocs.io/en/stable/", None),
88+
"docker": ("https://docker-py.readthedocs.io/en/stable/", None),
89+
"pypim": ("https://pypim.docs.pyansys.com/version/stable", None),
90+
"ansys.geometry.core": (f"https://geometry.docs.pyansys.com/version/{switcher_version}", None),
9091
}
9192

9293
# numpydoc configuration
@@ -208,12 +209,7 @@
208209
# variables are the title of pdf, watermark
209210
latex_elements = {"preamble": latex.generate_preamble(html_title)}
210211

211-
linkcheck_exclude_documents = ["index"]
212-
linkcheck_anchors_ignore_for_url = ["https://docs.pyvista.org/api/*"]
213-
linkcheck_ignore = [
214-
"https://github.com/ansys/pyansys-geometry/*",
215-
"https://geometry.docs.pyansys.com/*",
216-
]
212+
linkcheck_exclude_documents = ["index", "getting_started/creating_local_session"]
217213

218214
# -- Declare the Jinja context -----------------------------------------------
219215
exclude_patterns = []
@@ -246,3 +242,17 @@ def prepare_jinja_env(jinja_env) -> None:
246242

247243

248244
autoapi_prepare_jinja_env = prepare_jinja_env
245+
nitpick_ignore_regex = [
246+
# Ignore typing
247+
(r"py:.*", r"optional"),
248+
(r"py:.*", r"beartype.typing.*"),
249+
(r"py:.*", r"ansys.geometry.core.typing.*"),
250+
(r"py:.*", r"Real.*"),
251+
(r"py:.*", r"SketchObject"),
252+
# Ignore API package
253+
(r"py:.*", r"ansys.api.geometry.v0.*"),
254+
(r"py:.*", r"GRPC.*"),
255+
(r"py:.*", r"method"),
256+
# Python std lib errors
257+
(r"py:obj", r"logging.PercentStyle"),
258+
]

doc/source/getting_started/creating_local_session.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ either Discovery, SpaceClaim, or the Geometry service.
3939
For more information on the arguments accepted by the launcher methods, please refer
4040
to their API documentation:
4141

42-
* :func:`launch_modeler_with_discovery() <ansys.geometry.core.connection.launcher.launch_modeler_with_discovery>`
43-
* :func:`launch_modeler_with_spaceclaim() <ansys.geometry.core.connection.launcher.launch_modeler_with_spaceclaim>`
44-
* :func:`launch_modeler_with_geometry_service() <ansys.geometry.core.connection.launcher.launch_modeler_with_geometry_service>`
42+
* `launch_modeler_with_discovery <../api/ansys/geometry/core/connection/launcher/index.html#launcher.launch_modeler_with_discovery>`_
43+
* `launch_modeler_with_spaceclaim <../api/ansys/geometry/core/connection/launcher/index.html#launcher.launch_modeler_with_spaceclaim>`_
44+
* `launch_modeler_with_geometry_service <../api/ansys/geometry/core/connection/launcher/index.html#launcher.launch_modeler_with_geometry_service>`_
4545

4646
.. note::
4747

doc/styles/Vocab/ANSYS/accept.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ PyPI
2121
PyVista
2222
SciPy
2323
subpackage
24+
launch_modeler_with_discovery
25+
launch_modeler_with_spaceclaim
26+
launch_modeler_with_geometry_service

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ classifiers = [
2424
]
2525

2626
dependencies = [
27-
"ansys-api-geometry==0.2.15",
27+
"ansys-api-geometry==0.2.16",
2828
"ansys-tools-path>=0.3",
2929
"beartype>=0.11.0",
3030
"google-api-python-client>=1.7.11",
@@ -45,7 +45,7 @@ dependencies = [
4545
all = [
4646
"ansys-platform-instancemanagement>=1.0.3",
4747
"docker>=6.0.1",
48-
"pyvista[trame]>=0.38.1",
48+
"pyvista[trame]>=0.38.1,<0.42",
4949
]
5050
tests = [
5151
"ansys-platform-instancemanagement==1.1.2",
@@ -59,18 +59,18 @@ tests = [
5959
"numpy==1.25.2",
6060
"Pint==0.22",
6161
"protobuf==3.20.3",
62-
"pytest==7.4.1",
62+
"pytest==7.4.2",
6363
"pytest-cov==4.1.0",
6464
"pytest-pyvista==0.1.8",
6565
"pytest-xvfb==3.0.0",
66-
"pyvista[trame]==0.42.1",
66+
"pyvista[trame]==0.41.1",
6767
"requests==2.31.0",
6868
"scipy==1.11.2",
6969
"six==1.16.0",
7070
"vtk==9.2.6",
7171
]
7272
doc = [
73-
"ansys-sphinx-theme==0.11.0",
73+
"ansys-sphinx-theme==0.11.1",
7474
"docker==6.1.3",
7575
"ipyvtklink==0.2.3",
7676
"jupyter_sphinx==0.4.0",
@@ -81,7 +81,7 @@ doc = [
8181
"notebook==7.0.3",
8282
"numpydoc==1.5.0",
8383
"panel==1.2.2",
84-
"pyvista[trame]==0.42.1",
84+
"pyvista[trame]==0.41.1",
8585
"requests==2.31.0",
8686
"sphinx==7.2.5",
8787
"sphinx-autoapi==2.1.1", # "sphinx-autoapi @ git+https://github.com/jorgepiloto/sphinx-autoapi@feat/single-page-option", ---> Installed directly in workflow

0 commit comments

Comments
 (0)