From ae80b27c9bad72e76baac9b9f7319c1f9b4c210a Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Sat, 11 Jan 2025 13:37:09 -0600 Subject: [PATCH 1/7] pyproject.toml -> change cadquery-ocp dep to >= 7.8.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6ef699d..b89afad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ ] dependencies = [ - "cadquery-ocp >= 7.7.0", + "cadquery-ocp >= 7.8.1", "typing_extensions >= 4.6.0, <5", "numpy >= 2, <3", "svgpathtools >= 1.5.1, <2", From b93538c3119c911c40a0a546c3c4e1a2637cdcd7 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Sat, 11 Jan 2025 13:42:57 -0600 Subject: [PATCH 2/7] shape_core.py -> move to OCP>7.8 hash method --- src/build123d/topology/shape_core.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/build123d/topology/shape_core.py b/src/build123d/topology/shape_core.py index 63703d7..6933c55 100644 --- a/src/build123d/topology/shape_core.py +++ b/src/build123d/topology/shape_core.py @@ -167,7 +167,6 @@ if TYPE_CHECKING: # pragma: no cover from .composite import Compound # pylint: disable=R0801 from build123d.build_part import BuildPart # pylint: disable=R0801 -HASH_CODE_MAX = 2147483647 Shapes = Literal["Vertex", "Edge", "Wire", "Face", "Shell", "Solid", "Compound"] TrimmingTool = Union[Plane, "Shell", "Face"] TOPODS = TypeVar("TOPODS", bound=TopoDS_Shape) @@ -805,8 +804,10 @@ class Shape(NodeMixin, Generic[TOPODS]): return NotImplemented def __hash__(self) -> int: - """Return has code""" - return self.hash_code() + """Return hash code""" + if self.wrapped is None: + return 0 + return hash(self.wrapped) def __rmul__(self, other): """right multiply for positioning operator *""" @@ -1181,19 +1182,6 @@ class Shape(NodeMixin, Generic[TOPODS]): self.__class__.cast(s) for s in get_top_level_topods_shapes(self.wrapped) ) - def hash_code(self) -> int: - """Returns a hashed value denoting this shape. It is computed from the - TShape and the Location. The Orientation is not used. - - Args: - - Returns: - - """ - if self.wrapped is None: - return 0 - return self.wrapped.HashCode(HASH_CODE_MAX) - def intersect( self, *to_intersect: Shape | Axis | Plane ) -> None | Self | ShapeList[Self]: @@ -2852,7 +2840,7 @@ def _topods_entities(shape: TopoDS_Shape, topo_type: Shapes) -> list[TopoDS_Shap while explorer.More(): item = explorer.Current() - out[item.HashCode(HASH_CODE_MAX)] = ( + out[hash(item)] = ( item # needed to avoid pseudo-duplicate entities ) explorer.Next() From 42261cad6542f27dc39f4bc98ca6cd83c02fcf84 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Sat, 11 Jan 2025 14:31:50 -0600 Subject: [PATCH 3/7] @ocp781 test_direct_api.py-> test hash(empty) returns zero (modified) --- tests/test_direct_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_direct_api.py b/tests/test_direct_api.py index bc17a35..f26c958 100644 --- a/tests/test_direct_api.py +++ b/tests/test_direct_api.py @@ -3559,7 +3559,7 @@ class TestShape(DirectApiTestCase): with self.assertRaises(ValueError): empty.geom_type self.assertIs(empty, empty.fix()) - self.assertEqual(empty.hash_code(), 0) + self.assertEqual(hash(empty), 0) self.assertFalse(empty.is_same(Solid())) self.assertFalse(empty.is_equal(Solid())) self.assertTrue(empty.is_valid()) From 453ae630585a1e62896f127c71486814bdb7ec35 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 13 Jan 2025 10:42:49 -0600 Subject: [PATCH 4/7] pyproject.toml -> update cadquery-ocp, ocpsvg pins and formatting consistency --- pyproject.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b89afad..31a1eb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,16 +35,16 @@ classifiers = [ ] dependencies = [ - "cadquery-ocp >= 7.8.1", - "typing_extensions >= 4.6.0, <5", - "numpy >= 2, <3", - "svgpathtools >= 1.5.1, <2", - "anytree >= 2.8.0, <3", + "cadquery-ocp >= 7.8.0, < 7.9.0", + "typing_extensions >= 4.6.0, < 5", + "numpy >= 2, < 3", + "svgpathtools >= 1.5.1, < 2", + "anytree >= 2.8.0, < 3", "ezdxf >= 1.1.0, < 2", - "ipython >= 8.0.0, <9", + "ipython >= 8.0.0, < 9", "py-lib3mf >= 2.3.1", - "ocpsvg", - "trianglesolver" + "ocpsvg >= 0.4", + "trianglesolver", ] [project.urls] From 51cd21986029d492fc10befaab2cadecfd402e93 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 13 Jan 2025 11:54:49 -0600 Subject: [PATCH 5/7] pyproject.toml -> support python 3.13 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 31a1eb2..b474035 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ authors = [ ] description = "A python CAD programming library" readme = "README.md" -requires-python = ">= 3.10, < 3.13" +requires-python = ">= 3.10, < 3.14" keywords = [ "3d models", "3d printing", @@ -61,5 +61,5 @@ exclude = ["build123d._dev"] write_to = "src/build123d/_version.py" [tool.black] -target-version = ["py310", "py311", "py312"] +target-version = ["py310", "py311", "py312", "py313"] line-length = 88 From 33957e30dbc1ec5551ffb2d5743119cb8221c957 Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 13 Jan 2025 11:55:45 -0600 Subject: [PATCH 6/7] test.yml -> test on py310 and py313 (dropping py312) --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4efd4e..b636f04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,8 @@ jobs: python-version: [ "3.10", # "3.11", - "3.12", + # "3.12", + "3.13", ] os: [macos-13, macos-14, ubuntu-latest, windows-latest] From 4394187b6e0d7b95b434ec8581aca4eefb81407f Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 13 Jan 2025 11:56:39 -0600 Subject: [PATCH 7/7] mypy.yml -> mypy with py310 and py313 (dropping py312) --- .github/workflows/mypy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 9008650..79f10a2 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -9,7 +9,8 @@ jobs: python-version: [ "3.10", # "3.11", - "3.12", + # "3.12", + "3.13", ] runs-on: ubuntu-latest