Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyPy Type Failures #2464

Closed
1 of 4 tasks
MrArnoldPalmer opened this issue Jan 23, 2021 · 1 comment · Fixed by #2476
Closed
1 of 4 tasks

MyPy Type Failures #2464

MrArnoldPalmer opened this issue Jan 23, 2021 · 1 comment · Fixed by #2476
Labels
bug This issue is a bug. effort/medium Medium work item – a couple days of effort p1

Comments

@MrArnoldPalmer
Copy link
Contributor

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: v1.17.1
  • Platform: Darwin f8ffc25f2862.ant.amazon.com 19.6.0 Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64 x86_64

What is the problem?

Python code generated by jsii-pacmak fails mypy type checks. This doesn't seem to have been triggered by code changes in JSII so is likely the result of an update to mypy or another related lib.

Adding # type: ignore comments can resolve some of these errors easily, additional logic may be required to only add these comments where needed so we aren't suppressing valid type errors. Not sure what the exact cause is though.

Verbose Log

    #STDOUT> /tmp/harness.jsOMHEA9/python/src/jsii_calc/__init__.py:7010: error: Call to
    #STDOUT> untyped function "member" in typed context  [no-untyped-call]
    #STDOUT>         @jsii.member(jsii_name="baz")
    #STDOUT>          ^
    #STDOUT> /tmp/harness.jsOMHEA9/python/src/jsii_calc/__init__.py:7010: error: Untyped
    #STDOUT> decorator makes function "baz" untyped  [misc]
    #STDOUT>         @jsii.member(jsii_name="baz")
    #STDOUT>          ^
    #STDOUT> /tmp/harness.jsOMHEA9/python/src/jsii_calc/__init__.py:7012: error: Returning
    #STDOUT> Any from function declared to return "None"  [no-any-return]
    #STDOUT>             return jsii.invoke(self, "baz", [])
    #STDOUT>             ^
@MrArnoldPalmer MrArnoldPalmer added bug This issue is a bug. effort/medium Medium work item – a couple days of effort p1 labels Jan 23, 2021
RomainMuller added a commit that referenced this issue Jan 25, 2021
Updated the type annotations of the jsii runtime for Python so that the
decorators carry appropriate type signatures. Additionally, enhanced
the code generation for Python so that mypy errors that are difficult or
impossible to address are ignored by the tool without requiring specific
user configuration.

Fixes #2464
@MrArnoldPalmer MrArnoldPalmer changed the title My Type Failures MyPy Type Failures Jan 25, 2021
RomainMuller added a commit that referenced this issue Jan 26, 2021
It's been a couple of times `mypy` breaks the pipeline by releasing new
versions that are more strict or start checking things it used to
silently ignored.

In order to avoid this happening in the future (and putting us back in
control), this pins the `mypy` version to the exact release (the last
we successfully built with, in this case), and moves everything we
install though `pip install` into `requirements-dev.txt` files so that
@dependabot can help us stay up-to-date going forward.

Fixes #2464
@mergify mergify bot closed this as completed in #2476 Jan 26, 2021
mergify bot pushed a commit that referenced this issue Jan 26, 2021
It's been a couple of times `mypy` breaks the pipeline by releasing new
versions that are more strict or start checking things it used to
silently ignored.

In order to avoid this happening in the future (and putting us back in
control), this pins the `mypy` version to the exact release (the last
we successfully built with, in this case), and moves everything we
install though `pip install` into `requirements-dev.txt` files so that
@dependabot can help us stay up-to-date going forward.

Fixes #2464



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mergify bot pushed a commit that referenced this issue Jan 27, 2021
Updated the type annotations of the jsii runtime for Python so that the
decorators carry appropriate type signatures. Additionally, enhanced
the code generation for Python so that mypy errors that are difficult or
impossible to address are ignored by the tool without requiring specific
user configuration.

Relates to #2464, #2476



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/medium Medium work item – a couple days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant