Skip to content

Modernize type hints in shape module#2041

Draft
DavidMStraub wants to merge 1 commit into
CadQuery:masterfrom
DavidMStraub:shapes_modernize_types
Draft

Modernize type hints in shape module#2041
DavidMStraub wants to merge 1 commit into
CadQuery:masterfrom
DavidMStraub:shapes_modernize_types

Conversation

@DavidMStraub
Copy link
Copy Markdown

First of all sorry for submitting a PR modifying 300 lines without opening an issue first.

Background: as a user of the CadQuery functional API (also in teaching), I wanted to help improve the doc strings (and in some cases type hints) in the shapes module. But first, I realized type hints are a bit dated and can be updated in style since 3.11 is now the minimum Python version supported by CadQuery.

This PR does not contain any runtime or type hint changes, only updates notations:

  • Imports all needed types from the modern location
  • Uses built-in container types for type hints where possible
  • Does not use strings for forward references, but from __future__ import annotations (which can be easily dropped later).

I know it's also not 100% consistent to only do this with one module for now, but it would unblock me for making further improvements here.

@DavidMStraub
Copy link
Copy Markdown
Author

Oops, probably bad idea to do this before #2038. @adam-urbanczyk, please let me know how you'd like me to proceed. I could resubmit this after #2038 is merged.

@adam-urbanczyk
Copy link
Copy Markdown
Member

Yup, let's do this after 2038

@adam-urbanczyk adam-urbanczyk marked this pull request as draft May 29, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants