Skip to content

Commit

Permalink
update cadquery_ocp dependency to 7.8.1 (#39)
Browse files Browse the repository at this point in the history
* update `cadquery_ocp` dependency to `7.8.1`

* drop python `3.9`
  • Loading branch information
snoyer authored Jan 13, 2025
1 parent 58ab090 commit 5e1d92e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
python-version:
- "3.10"
- "3.12"
os:
- macos-13
- ubuntu-latest
Expand Down
11 changes: 3 additions & 8 deletions ocpsvg/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,12 @@ def wire_to_svg_path(
# but wires can be non-manifold or otherwise degenerate and may not have visit them all.
# We'll add remaining edges individually

# TODO use native hashcode when OCP 7.8 is out
MAX_HASHCODE = (1 << 31) - 1

def hashcode(shape: TopoDS_Shape):
return shape.HashCode(MAX_HASHCODE)

all_edges = {hashcode(e): e for e in map(TopoDS.Edge_s, topoDS_iterator(wire))}
#TODO use a set if/when OCP implements `__eq__`
all_edges = {hash(e): e for e in map(TopoDS.Edge_s, topoDS_iterator(wire))}

if len(ordered_edges) < len(all_edges):
for e in ordered_edges:
all_edges.pop(hashcode(e))
all_edges.pop(hash(e))

yield from chain.from_iterable(
edge_to_svg_path(
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
[project]
name = "ocpsvg"
readme = "readme-pypi.md"
version = "0.3.4"
requires-python = ">=3.9"
version = "0.4.0"
requires-python = ">=3.10"
dependencies = [
"cadquery-ocp >= 7.7.0, <7.8",
"cadquery-ocp >= 7.8.1, < 7.9.0",
"svgelements >= 1.9.1, <2",
]

Expand Down
3 changes: 2 additions & 1 deletion tests/test_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ def test_nonmanifold_wire():
)
cmd_counts = Counter(cmd[0] for cmd in wire_to_svg_path(wire, tolerance=1e-6))
assert cmd_counts["M"] > 1
# exact count is order-dependent and may be non-deterministic
assert sum(cmd_counts.values()) < 12
# exact counts may be order-dependent and non-deterministic


@pytest.mark.parametrize(
Expand Down

0 comments on commit 5e1d92e

Please sign in to comment.