Skip to content

Typing change with OCP 7.9.3.0 stubs, question about approach #191

@jdegenstein

Description

@jdegenstein

Here is a change that was picked up by mypy which resulted in a typing failure:

# stubs 7.8.1.1.post1
class Geom2dAPI_ProjectPointOnCurve...
    @overload
    def Parameter(self,Index : int) -> float: 
    @overload
    def Parameter(self,Index : int) -> tuple[float]: ...
# stubs 7.9.3.0
class Geom2dAPI_ProjectPointOnCurve...
    @overload
    def Parameter(self,Index : int) -> tuple[float]: 
    @overload
    def Parameter(self,Index : int) -> float: ...

On 7.8.1.1.post1 mypy was happy to assume that the return type of this was float whereas on the new stubs 7.9.3.0 mypy inferred tuple[float]. Given the method inputs are the same (i.e. self,Index : int) should the pyi file look like this instead?

class Geom2dAPI_ProjectPointOnCurve...
    def Parameter(self,Index : int) -> float | tuple[float]: 

EDIT: I can confirm this is also platform-related as the above 7.9.3.0 is for windows, whereas on macosx_arm64 it retains the older 7.8.1.1.post1 ordering.

Also, all wheels were taken from PyPI.
https://pypi.org/project/cadquery-ocp-stubs/7.9.3.0/#files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions