luminarycloud 0.20.0__py3-none-any.whl → 0.21.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. luminarycloud/__init__.py +2 -0
  2. luminarycloud/_client/http_client.py +10 -8
  3. luminarycloud/_helpers/_upload_mesh.py +1 -0
  4. luminarycloud/_helpers/pagination.py +62 -0
  5. luminarycloud/_helpers/upload.py +18 -12
  6. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.py +168 -124
  7. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.pyi +125 -3
  8. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.py +66 -0
  9. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.pyi +20 -0
  10. luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.py +8 -8
  11. luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.pyi +5 -5
  12. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.py +66 -19
  13. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.pyi +92 -0
  14. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2_grpc.py +33 -0
  15. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2_grpc.pyi +10 -0
  16. luminarycloud/_proto/assistant/assistant_pb2.py +61 -41
  17. luminarycloud/_proto/assistant/assistant_pb2.pyi +43 -1
  18. luminarycloud/_proto/assistant/assistant_pb2_grpc.py +33 -0
  19. luminarycloud/_proto/assistant/assistant_pb2_grpc.pyi +10 -0
  20. luminarycloud/_proto/base/base_pb2.py +9 -6
  21. luminarycloud/_proto/base/base_pb2.pyi +12 -0
  22. luminarycloud/_proto/client/simulation_pb2.py +490 -348
  23. luminarycloud/_proto/client/simulation_pb2.pyi +570 -8
  24. luminarycloud/_proto/inferenceservice/inferenceservice_pb2.py +10 -10
  25. luminarycloud/_proto/inferenceservice/inferenceservice_pb2.pyi +5 -5
  26. luminarycloud/_proto/quantity/quantity_pb2.py +24 -15
  27. luminarycloud/_proto/quantity/quantity_pb2.pyi +10 -4
  28. luminarycloud/enum/__init__.py +1 -0
  29. luminarycloud/enum/quantity_type.py +9 -0
  30. luminarycloud/enum/vis_enums.py +23 -3
  31. luminarycloud/geometry.py +41 -1
  32. luminarycloud/geometry_version.py +57 -3
  33. luminarycloud/params/enum/_enum_wrappers.py +537 -30
  34. luminarycloud/params/simulation/adaptive_mesh_refinement_.py +4 -0
  35. luminarycloud/params/simulation/physics/__init__.py +0 -1
  36. luminarycloud/params/simulation/physics/periodic_pair_.py +12 -31
  37. luminarycloud/physics_ai/architectures.py +5 -5
  38. luminarycloud/physics_ai/inference.py +13 -13
  39. luminarycloud/pipelines/__init__.py +8 -0
  40. luminarycloud/pipelines/api.py +159 -4
  41. luminarycloud/pipelines/arguments.py +15 -0
  42. luminarycloud/pipelines/operators.py +74 -17
  43. luminarycloud/project.py +5 -44
  44. luminarycloud/simulation.py +9 -3
  45. luminarycloud/simulation_param.py +0 -9
  46. luminarycloud/vis/__init__.py +2 -0
  47. luminarycloud/vis/interactive_report.py +79 -93
  48. luminarycloud/vis/report.py +219 -65
  49. luminarycloud/vis/visualization.py +60 -0
  50. luminarycloud/volume_selection.py +58 -9
  51. {luminarycloud-0.20.0.dist-info → luminarycloud-0.21.1.dist-info}/METADATA +1 -1
  52. {luminarycloud-0.20.0.dist-info → luminarycloud-0.21.1.dist-info}/RECORD +53 -57
  53. luminarycloud/params/simulation/physics/periodic_pair/__init__.py +0 -2
  54. luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/__init__.py +0 -2
  55. luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/rotational_periodicity_.py +0 -31
  56. luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/translational_periodicity_.py +0 -29
  57. luminarycloud/params/simulation/physics/periodic_pair/periodicity_type_.py +0 -25
  58. {luminarycloud-0.20.0.dist-info → luminarycloud-0.21.1.dist-info}/WHEEL +0 -0
luminarycloud/geometry.py CHANGED
@@ -29,7 +29,7 @@ from .named_variable_set import NamedVariableSet, get_named_variable_set
29
29
 
30
30
  if TYPE_CHECKING:
31
31
  from .project import Project
32
- from .geometry_version import GeometryVersion
32
+ from .geometry_version import GeometryVersion, GeometryVersionIterator
33
33
 
34
34
 
35
35
  @ProtoWrapper(geometrypb.Geometry)
@@ -292,6 +292,46 @@ class Geometry(ProtoWrapperBase):
292
292
  )
293
293
  )
294
294
 
295
+ def versions(self, unfiltered: bool = False, page_size: int = 50) -> "GeometryVersionIterator":
296
+ """
297
+ List the geometry versions for this geometry in chronological order, oldest first.
298
+
299
+ By default, this only returns versions that are named OR have an associated Mesh OR are the
300
+ latest version of the geometry. If `unfiltered` is true, this returns all versions.
301
+
302
+ The geometry versions are fetched lazily in batches using pagination to optimize memory
303
+ usage and API calls.
304
+
305
+ Parameters
306
+ ----------
307
+ unfiltered : bool, optional
308
+ If True, returns all versions. If False, returns only versions that are named OR have an
309
+ associated Mesh OR are the latest version of the geometry. Defaults to False.
310
+ page_size : int, optional
311
+ Number of geometry versions to fetch per page. Defaults to 50, max is 500.
312
+
313
+ Returns
314
+ -------
315
+ GeometryVersionIterator
316
+ An iterator that yields GeometryVersion objects one at a time.
317
+
318
+ Examples
319
+ --------
320
+ Fetch the versions of this geometry with default filtering applied.
321
+ >>> for version in geometry.versions():
322
+ ... print(version.id, version.name)
323
+
324
+ Fetch all versions of the geometry.
325
+ >>> for version in geometry.versions(unfiltered=True):
326
+ ... print(version.id, version.name)
327
+
328
+ Build a list of versions of this geometry that have the name "So Important".
329
+ >>> important_versions = [ver for ver in geometry.versions() if ver.name == "So Important"]
330
+ """
331
+ from .geometry_version import GeometryVersionIterator
332
+
333
+ return GeometryVersionIterator(self.id, unfiltered, page_size)
334
+
295
335
  def latest_version(self) -> GeometryVersion:
296
336
  """
297
337
  Get the latest version of the geometry.
@@ -3,6 +3,7 @@ from datetime import datetime
3
3
 
4
4
  from ._client import get_default_client
5
5
  from ._helpers._timestamp_to_datetime import timestamp_to_datetime
6
+ from ._helpers.pagination import PaginationIterator
6
7
  from ._proto.api.v0.luminarycloud.geometry import geometry_pb2 as geometrypb
7
8
  from ._proto.geometry import geometry_pb2 as gpb
8
9
  from ._wrapper import ProtoWrapper, ProtoWrapperBase
@@ -87,7 +88,7 @@ class GeometryVersion(ProtoWrapperBase):
87
88
  ]
88
89
  return surfaces, volumes
89
90
 
90
- def copy_to_new_geometry(self, name: str = "") -> Geometry:
91
+ def copy_to_new_geometry(self, name: str = "", request_id: str = "") -> Geometry:
91
92
  """
92
93
  Copy this GeometryVersion and create a new Geometry containing only that newly copied version.
93
94
 
@@ -95,6 +96,11 @@ class GeometryVersion(ProtoWrapperBase):
95
96
  ----------
96
97
  name : str, optional
97
98
  The name of the new Geometry. If not provided, a default name will be used.
99
+ request_id : str, optional
100
+ A deduplication key, useful for idempotency. The first time copy_to_new_geometry() is
101
+ called with a given request_id, a new geometry will be created. Subsequent calls with
102
+ the same request_id will return the same geometry. If not provided, no deduplication is
103
+ done. Max length: 256 characters.
98
104
 
99
105
  Returns
100
106
  -------
@@ -104,6 +110,7 @@ class GeometryVersion(ProtoWrapperBase):
104
110
  req = geometrypb.CopyGeometryFromVersionRequest(
105
111
  geometry_version_id=self.id,
106
112
  name=name,
113
+ request_id=request_id,
107
114
  )
108
115
  res: geometrypb.CopyGeometryFromVersionResponse = (
109
116
  get_default_client().CopyGeometryFromVersion(req)
@@ -173,14 +180,39 @@ class GeometryVersion(ProtoWrapperBase):
173
180
  return res.sdk_code
174
181
 
175
182
 
183
+ class GeometryVersionIterator(PaginationIterator[GeometryVersion]):
184
+ """Iterator class for geometry versions that provides length hint."""
185
+
186
+ def __init__(self, geometry_id: str, unfiltered: bool, page_size: int):
187
+ super().__init__(page_size)
188
+ self._geometry_id: str = geometry_id
189
+ self._unfiltered: bool = unfiltered
190
+
191
+ def _fetch_page(
192
+ self, page_size: int, page_token: str
193
+ ) -> tuple[list[GeometryVersion], str, int]:
194
+ req = geometrypb.ListGeometryVersionsRequest(
195
+ page_size=page_size,
196
+ page_token=page_token,
197
+ geometry_id=self._geometry_id,
198
+ unfiltered=self._unfiltered,
199
+ )
200
+ res = self._client.ListGeometryVersions(req)
201
+ return (
202
+ [GeometryVersion(gv) for gv in res.geometry_versions],
203
+ res.next_page_token,
204
+ res.total_count,
205
+ )
206
+
207
+
176
208
  def get_geometry_version(id: str) -> GeometryVersion:
177
209
  """
178
- Get a specific geometry version with the given ID.
210
+ Get a geometry version by its ID.
179
211
 
180
212
  Parameters
181
213
  ----------
182
214
  id : str
183
- Geometry version ID.
215
+ ID of the geometry version to get.
184
216
 
185
217
  Returns
186
218
  -------
@@ -191,3 +223,25 @@ def get_geometry_version(id: str) -> GeometryVersion:
191
223
  req = geometrypb.GetGeometryVersionRequest(geometry_version_id=id)
192
224
  res: geometrypb.GetGeometryVersionResponse = get_default_client().GetGeometryVersion(req)
193
225
  return GeometryVersion(res.geometry_version)
226
+
227
+
228
+ def update_geometry_version(id: str, name: str) -> GeometryVersion:
229
+ """
230
+ Update a geometry version.
231
+
232
+ Parameters
233
+ ----------
234
+ id : str
235
+ ID of the geometry version to update.
236
+ name : str
237
+ The new name for the geometry version. Pass an empty string to clear the name.
238
+
239
+ Returns
240
+ -------
241
+ GeometryVersion
242
+ The updated GeometryVersion.
243
+ """
244
+
245
+ req = geometrypb.UpdateGeometryVersionRequest(geometry_version_id=id, name=name)
246
+ res: geometrypb.UpdateGeometryVersionResponse = get_default_client().UpdateGeometryVersion(req)
247
+ return GeometryVersion(res.geometry_version)