Skip to content

Commit 63c7ef2

Browse files
authored
MAINT: improving docs generation (#696)
1 parent 5564eb2 commit 63c7ef2

Some content is hidden

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

50 files changed

+327
-301
lines changed

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

src/ansys/geometry/core/connection/conversions.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from ansys.api.geometry.v0.models_pb2 import Direction as GRPCDirection
2727
from ansys.api.geometry.v0.models_pb2 import Ellipse as GRPCEllipse
2828
from ansys.api.geometry.v0.models_pb2 import Frame as GRPCFrame
29-
from ansys.api.geometry.v0.models_pb2 import Geometries
29+
from ansys.api.geometry.v0.models_pb2 import Geometries as GRPCGeometries
3030
from ansys.api.geometry.v0.models_pb2 import Line as GRPCLine
3131
from ansys.api.geometry.v0.models_pb2 import Matrix as GRPCMatrix
3232
from ansys.api.geometry.v0.models_pb2 import Plane as GRPCPlane
@@ -35,17 +35,19 @@
3535
from ansys.api.geometry.v0.models_pb2 import Tessellation
3636
from beartype.typing import TYPE_CHECKING, List, Optional, Tuple
3737

38-
from ansys.geometry.core.math import Frame, Matrix44, Plane, Point2D, Point3D, UnitVector3D
39-
from ansys.geometry.core.misc import DEFAULT_UNITS
40-
from ansys.geometry.core.sketch import (
41-
Arc,
42-
Polygon,
43-
SketchCircle,
44-
SketchEdge,
45-
SketchEllipse,
46-
SketchFace,
47-
SketchSegment,
48-
)
38+
from ansys.geometry.core.math.frame import Frame
39+
from ansys.geometry.core.math.matrix import Matrix44
40+
from ansys.geometry.core.math.plane import Plane
41+
from ansys.geometry.core.math.point import Point2D, Point3D
42+
from ansys.geometry.core.math.vector import UnitVector3D
43+
from ansys.geometry.core.misc.measurements import DEFAULT_UNITS
44+
from ansys.geometry.core.sketch.arc import Arc
45+
from ansys.geometry.core.sketch.circle import SketchCircle
46+
from ansys.geometry.core.sketch.edge import SketchEdge
47+
from ansys.geometry.core.sketch.ellipse import SketchEllipse
48+
from ansys.geometry.core.sketch.face import SketchFace
49+
from ansys.geometry.core.sketch.polygon import Polygon
50+
from ansys.geometry.core.sketch.segment import SketchSegment
4951

5052
if TYPE_CHECKING: # pragma: no cover
5153
from pyvista import PolyData
@@ -117,9 +119,9 @@ def sketch_shapes_to_grpc_geometries(
117119
edges: List[SketchEdge],
118120
faces: List[SketchFace],
119121
only_one_curve: Optional[bool] = False,
120-
) -> Geometries:
122+
) -> GRPCGeometries:
121123
"""
122-
Convert lists of ``SketchEdge`` and ``SketchFace`` to a ``Geometries`` gRPC message.
124+
Convert lists of ``SketchEdge`` and ``SketchFace`` to a ``GRPCGeometries`` message.
123125
124126
Parameters
125127
----------
@@ -129,18 +131,16 @@ def sketch_shapes_to_grpc_geometries(
129131
Source edge data.
130132
faces : List[SketchFace]
131133
Source face data.
132-
shapes : List[BaseShape]
133-
Source shape data.
134134
only_one_curve : bool, default: False
135135
Whether to project one curve of the whole set of geometries to
136136
enhance performance.
137137
138138
Returns
139139
-------
140-
Geometries
140+
GRPCGeometries
141141
Geometry service gRPC geometries message. The unit is meters.
142142
"""
143-
geometries = Geometries()
143+
geometries = GRPCGeometries()
144144

145145
converted_sketch_edges = sketch_edges_to_grpc_geometries(edges, plane)
146146
geometries.lines.extend(converted_sketch_edges[0])
@@ -159,7 +159,7 @@ def sketch_shapes_to_grpc_geometries(
159159
geometries.arcs.extend(converted_face_edges[1])
160160

161161
if only_one_curve:
162-
one_curve_geometry = Geometries()
162+
one_curve_geometry = GRPCGeometries()
163163
if len(geometries.lines) > 0:
164164
one_curve_geometry.lines.append(geometries.lines[0])
165165
elif len(geometries.arcs) > 0:
@@ -181,7 +181,7 @@ def sketch_edges_to_grpc_geometries(
181181
plane: Plane,
182182
) -> Tuple[List[GRPCLine], List[GRPCArc]]:
183183
"""
184-
Convert a list of ``SketchEdge`` to a ``Geometries`` gRPC message.
184+
Convert a list of ``SketchEdge`` to a ``GRPCGeometries`` gRPC message.
185185
186186
Parameters
187187
----------

src/ansys/geometry/core/connection/launcher.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from beartype.typing import TYPE_CHECKING, Dict, Optional
2626

2727
from ansys.geometry.core.connection.backend import ApiVersions, BackendType
28+
from ansys.geometry.core.connection.client import MAX_MESSAGE_LENGTH
2829
from ansys.geometry.core.connection.defaults import DEFAULT_PIM_CONFIG, DEFAULT_PORT
2930
from ansys.geometry.core.connection.local_instance import (
3031
_HAS_DOCKER,
@@ -33,7 +34,7 @@
3334
)
3435
from ansys.geometry.core.connection.product_instance import prepare_and_start_backend
3536
from ansys.geometry.core.logger import LOG as logger
36-
from ansys.geometry.core.misc import check_type
37+
from ansys.geometry.core.misc.checks import check_type
3738

3839
try:
3940
import ansys.platform.instancemanagement as pypim
@@ -42,7 +43,6 @@
4243
except ModuleNotFoundError: # pragma: no cover
4344
_HAS_PIM = False
4445

45-
from ansys.geometry.core.connection.client import MAX_MESSAGE_LENGTH
4646

4747
if TYPE_CHECKING: # pragma: no cover
4848
from ansys.geometry.core.modeler import Modeler
@@ -61,7 +61,7 @@ def launch_modeler(**kwargs: Optional[Dict]) -> "Modeler":
6161
6262
Returns
6363
-------
64-
ansys.geometry.core.Modeler
64+
ansys.geometry.core.modeler.Modeler
6565
Pythonic interface for geometry modeling.
6666
6767
Examples
@@ -207,7 +207,7 @@ def launch_modeler_with_discovery_and_pimlight(version: Optional[str] = None) ->
207207
208208
Returns
209209
-------
210-
ansys.geometry.core.Modeler
210+
ansys.geometry.core.modeler.Modeler
211211
Instance of Modeler.
212212
"""
213213
return _launch_pim_instance(
@@ -236,7 +236,7 @@ def launch_modeler_with_geometry_service_and_pimlight(version: Optional[str] = N
236236
237237
Returns
238238
-------
239-
ansys.geometry.core.Modeler
239+
ansys.geometry.core.modeler.Modeler
240240
Instance of Modeler.
241241
"""
242242
return _launch_pim_instance(
@@ -265,7 +265,7 @@ def launch_modeler_with_spaceclaim_and_pimlight(version: Optional[str] = None) -
265265
266266
Returns
267267
-------
268-
ansys.geometry.core.Modeler
268+
ansys.geometry.core.modeler.Modeler
269269
Instance of Modeler.
270270
"""
271271
return _launch_pim_instance(
@@ -375,7 +375,7 @@ def launch_modeler_with_discovery(
375375
376376
Parameters
377377
----------
378-
product_version: ``int``, optional
378+
product_version: int, optional
379379
The product version to be started. Goes from v23.2.1 to
380380
the latest. Default is ``None``.
381381
If a specific product version is requested but not installed locally,
@@ -398,7 +398,7 @@ def launch_modeler_with_discovery(
398398
3: Error
399399
400400
The default is ``2`` (Warning).
401-
api_version: ``ApiVersions``, optional
401+
api_version: ApiVersions, optional
402402
The backend's API version to be used at runtime. Goes from API v21 to
403403
the latest. Default is ``ApiVersions.LATEST``.
404404
timeout : int, optional
@@ -467,7 +467,7 @@ def launch_modeler_with_spaceclaim(
467467
468468
Parameters
469469
----------
470-
product_version: ``int``, optional
470+
product_version: int, optional
471471
The product version to be started. Goes from v23.2.1 to
472472
the latest. Default is ``None``.
473473
If a specific product version is requested but not installed locally,
@@ -490,7 +490,7 @@ def launch_modeler_with_spaceclaim(
490490
3: Error
491491
492492
The default is ``2`` (Warning).
493-
api_version: ``ApiVersions``, optional
493+
api_version: ApiVersions, optional
494494
The backend's API version to be used at runtime. Goes from API v21 to
495495
the latest. Default is ``ApiVersions.LATEST``.
496496
timeout : int, optional

src/ansys/geometry/core/connection/local_instance.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from beartype.typing import Optional, Tuple, Union
2929

3030
try:
31-
import docker
31+
from docker.client import DockerClient
3232
from docker.errors import APIError, ContainerError, ImageNotFound
3333
from docker.models.containers import Container
3434

@@ -97,7 +97,7 @@ class LocalDockerInstance:
9797
OS.
9898
"""
9999

100-
__DOCKER_CLIENT__: "docker.DockerClient" = None
100+
__DOCKER_CLIENT__: "DockerClient" = None
101101
"""
102102
Docker client class variable. The default is ``None``, in which case lazy
103103
initialization is used.
@@ -110,7 +110,7 @@ class LocalDockerInstance:
110110

111111
@staticmethod
112112
@_docker_python_available
113-
def docker_client() -> "docker.DockerClient":
113+
def docker_client() -> "DockerClient":
114114
"""
115115
Get the initialized ``__DOCKER_CLIENT__`` object.
116116
@@ -121,11 +121,11 @@ def docker_client() -> "docker.DockerClient":
121121
122122
Returns
123123
-------
124-
docker.DockerClient
124+
~docker.client.DockerClient
125125
Initialized Docker client.
126126
"""
127127
if not LocalDockerInstance.__DOCKER_CLIENT__:
128-
LocalDockerInstance.__DOCKER_CLIENT__ = docker.from_env()
128+
LocalDockerInstance.__DOCKER_CLIENT__ = DockerClient.from_env()
129129

130130
return LocalDockerInstance.__DOCKER_CLIENT__
131131

src/ansys/geometry/core/designer/beam.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
from beartype.typing import TYPE_CHECKING, Union
2525

26-
from ansys.geometry.core.math import Point3D, UnitVector3D
27-
from ansys.geometry.core.misc import Distance, check_type
26+
from ansys.geometry.core.math.point import Point3D
27+
from ansys.geometry.core.math.vector import UnitVector3D
28+
from ansys.geometry.core.misc.checks import check_type
29+
from ansys.geometry.core.misc.measurements import Distance
2830

2931
if TYPE_CHECKING: # pragma: no cover
3032
from ansys.geometry.core.designer.component import Component

src/ansys/geometry/core/designer/body.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,28 @@
4343
from beartype.typing import TYPE_CHECKING, List, Optional, Tuple, Union
4444
from pint import Quantity
4545

46-
from ansys.geometry.core.connection import (
47-
GrpcClient,
46+
from ansys.geometry.core.connection.client import GrpcClient
47+
from ansys.geometry.core.connection.conversions import (
4848
sketch_shapes_to_grpc_geometries,
4949
tess_to_pd,
5050
unit_vector_to_grpc_direction,
5151
)
5252
from ansys.geometry.core.designer.edge import CurveType, Edge
5353
from ansys.geometry.core.designer.face import Face, SurfaceType
5454
from ansys.geometry.core.errors import protect_grpc
55-
from ansys.geometry.core.materials import Material
56-
from ansys.geometry.core.math import IDENTITY_MATRIX44, Matrix44, UnitVector3D
57-
from ansys.geometry.core.misc import DEFAULT_UNITS, Distance, check_type
58-
from ansys.geometry.core.sketch import Sketch
55+
from ansys.geometry.core.materials.material import Material
56+
from ansys.geometry.core.math.constants import IDENTITY_MATRIX44
57+
from ansys.geometry.core.math.matrix import Matrix44
58+
from ansys.geometry.core.math.vector import UnitVector3D
59+
from ansys.geometry.core.misc.checks import check_type
60+
from ansys.geometry.core.misc.measurements import DEFAULT_UNITS, Distance
61+
from ansys.geometry.core.sketch.sketch import Sketch
5962
from ansys.geometry.core.typing import Real
6063

6164
if TYPE_CHECKING: # pragma: no cover
6265
from pyvista import MultiBlock, PolyData
6366

6467
from ansys.geometry.core.designer.component import Component
65-
from ansys.geometry.core.designer.design import MidSurfaceOffsetType
6668

6769

6870
@unique
@@ -178,7 +180,7 @@ def add_midsurface_thickness(self, thickness: Quantity) -> None:
178180
179181
Parameters
180182
----------
181-
thickness : Quantity
183+
thickness : ~pint.Quantity
182184
Thickness to assign.
183185
184186
Notes
@@ -308,7 +310,7 @@ def translate(self, direction: UnitVector3D, distance: Union[Quantity, Distance,
308310
----------
309311
direction: UnitVector3D
310312
Direction of the translation.
311-
distance: Union[Quantity, Distance, Real]
313+
distance: Union[~pint.Quantity, Distance, Real]
312314
Distance (magnitude) of the translation.
313315
314316
Returns
@@ -417,7 +419,7 @@ def plot(
417419
is used.
418420
**plotting_options : dict, default: None
419421
Keyword arguments for plotting. For allowable keyword arguments, see the
420-
:func:`pyvista.Plotter.add_mesh` method.
422+
:meth:`Plotter.add_mesh <pyvista.Plotter.add_mesh>` method.
421423
422424
Examples
423425
--------

0 commit comments

Comments
 (0)