Skip to content

Eventually upgrade mypy #1124

@appleby

Description

@appleby

In #1119 @erichulburd noticed that make typecheck was failing with mypy 0.750 and so pinned our mypy dependency to 0.740 as a workaround.

The type errors on mypy 0.750 stem from the definition of ExpressionDesignator in quilatom.py, which is a nested Union type like so:

ExpressionValueDesignator = Union[int, float, complex]
ExpressionDesignator = Union['Expression', ExpressionValueDesignator]

Long story short, mypy 0.750 doesn't like the nested ExpressionValueDesignator.

As a workaround, flattening the Union like so resolves the issue:

ExpressionValueDesignator = Union[int, float, complex]
-ExpressionDesignator = Union['Expression', ExpressionValueDesignator]
+ExpressionDesignator = Union['Expression', int, float, complex]

I've opened a mypy issue upstream.

For now we should just keep mypy pinned to 0.740, but when/if the above mypy issue is addressed, we me might consider upgrading, or else apply the above patch if the mypy issue is resolved as "wont fix".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions