Skip to content

Commit 7889b37

Browse files
committed
move rdp to optional dev dep, cgal always available
1 parent d5c11b5 commit 7889b37

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ dependencies = [
3636
"numpy>=2.0",
3737
"progressbar2>=4.5",
3838
"pyclipper>=1.3",
39-
"rdp>=0.8",
4039
"scipy>=1.16",
4140
"tomli>=2.0; python_version < '3.11'",
4241
]
@@ -58,6 +57,7 @@ dev = [
5857
"pytest>=7.0",
5958
"pytest-benchmark",
6059
"pytest-cov",
60+
"rdp>=0.8",
6161
"ruff",
6262
"twine",
6363
]

src/compas_slicer/post_processing/simplify_paths_rdp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
from typing import TYPE_CHECKING
44

55
import numpy as np
6-
import rdp as rdp_py
76
from compas.geometry import Point
87
from loguru import logger
98

9+
try:
10+
import rdp as rdp_py
11+
except ImportError:
12+
rdp_py = None
13+
1014
if TYPE_CHECKING:
1115
from compas_slicer.slicers import BaseSlicer
1216

@@ -69,6 +73,9 @@ def _simplify_paths_cgal(slicer: BaseSlicer, threshold: float) -> None:
6973

7074
def _simplify_paths_python(slicer: BaseSlicer, threshold: float) -> None:
7175
"""Simplify paths using Python rdp library."""
76+
if rdp_py is None:
77+
raise ImportError("rdp package required for Python fallback. Install with: pip install rdp")
78+
7279
logger.info("Paths simplification rdp (Python)")
7380
remaining_pts_num = 0
7481

0 commit comments

Comments
 (0)