Skip to content

Conversation

@adam-urbanczyk
Copy link
Member

@adam-urbanczyk adam-urbanczyk commented Jan 15, 2026

Quite some scope creep, but IMO this is very important

  • Enable type checking of mutlimethod and multidispatch
  • Fix detected mypy issues (hence some changes in Sketch and Workplane)
  • Rework geom to use multidispatch
  • Rework shapes to partially use multidispatch. NB: the goal is to use it everywhere eventually.

Solves #1830

@adam-urbanczyk adam-urbanczyk mentioned this pull request Jan 15, 2026
6 tasks
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 97.91667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.00%. Comparing base (f3c5536) to head (5f4c5e3).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
cadquery/occ_impl/shapes.py 97.47% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1969      +/-   ##
==========================================
+ Coverage   95.86%   96.00%   +0.14%     
==========================================
  Files          29       29              
  Lines        7949     9355    +1406     
  Branches     1194     1592     +398     
==========================================
+ Hits         7620     8981    +1361     
- Misses        191      216      +25     
- Partials      138      158      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adam-urbanczyk adam-urbanczyk marked this pull request as draft January 19, 2026 20:38
@adam-urbanczyk adam-urbanczyk changed the title Fix free func cone dispatching Multimethod changes and type checkingdispatching Jan 21, 2026
@adam-urbanczyk adam-urbanczyk changed the title Multimethod changes and type checkingdispatching Multimethod changes and type checking Jan 21, 2026
@adam-urbanczyk adam-urbanczyk marked this pull request as ready for review January 21, 2026 18:45
Copy link
Member

@jmwright jmwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adam-urbanczyk

I made a few comments, but otherwise it looks good.


wire_lists = [[w] for w in _get_wires(el)]

# if not faces and vertices were detected return an empty list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if not faces and vertices were detected return an empty list
# if no faces and vertices were detected return an empty list


face_lists = [[f] for f in el.Faces()]

# if not faces were detected return an empty list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if not faces were detected return an empty list
# if no faces were detected return an empty list


class cqmultimethod(multimethod):
def __call__(self, *args, **kwargs):
# class cqmultimethod(multimethod):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this left commented?

return super().__call__(*args, **kwargs)
except DispatchError:
return next(iter(self.values()))(*args, **kwargs)
# try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Wondering why the block was left in but commented.

Copy link
Member

@lorenzncode lorenzncode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a few minor typo and lint check items. Thanks @adam-urbanczyk !


assert s3.map(lambda x: f).subtract().reset().val().Area() == approx(0.9)

# check that adding without selection does not raise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in comment; adding -> subtract

# check that subtract without selection does not raise


wire_lists: List[List[Wire]] = []

ix_last = len(s) - 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local variable ix_last is assigned to but never used


face_lists: List[List[Face]] = []

ix_last = len(s) - 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local variable ix_last is assigned to but never used

from multimethod import multimethod, DispatchError
from multimethod import (
multidispatch as _multidispatch,
DispatchError,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multimethod.DispatchError imported but unused


from ..types import Real
from ..utils import multimethod
from ..utils import multimethod, multidispatch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..utils.multimethod imported but unused


assert A().f(a=0, c="s") == 1

with raises(TypeError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest.raises imported but unused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants