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

feat: upgrade python runtime version of typeguard to >=3.0.2 #4470

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sam-goodwin
Copy link

@sam-goodwin sam-goodwin commented Mar 31, 2024


Closes: #4469

This change upgrades the python runtime's version of typeguard to >=3.0.2 which was a significant breaking change where argname was removed.

  • I am unsure what the impact of removing argname is on error messages.

It also adds @typing.runtime_checkable to all interfaces (I*) because of raised warnings.

  • I am still unclear whether the runtime_checkable decorator was required because I can't explain why it wasn't required before. But, my monkey-patch experiments resulted in a ton of warnings such as:
/./packyak.config.py:11: UserWarning: Typeguard cannot check the IReusableStackSynthesizer protocol because it is a non-runtime protocol. If you would like to type check this protocol, please use @typing.runtime_checkable
  return old_check_type(*args, **kwargs)
/./packyak.config.py:11: UserWarning: Typeguard cannot check the IStackSynthesizer protocol because it is a non-runtime protocol. If you would like to type check this protocol, please use @typing.runtime_checkable
  return old_check_type(*args, **kwargs)

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

@sam-goodwin
Copy link
Author

Looks like there are some test failures around interfaces. Will dig into these. I thought I ran the tests locally but will check again.

@sam-goodwin
Copy link
Author

Strange:

@jsii/python-runtime: E       typeguard.TypeCheckError: method did not match any element in the union:
@jsii/python-runtime: E         int: is not an instance of int
@jsii/python-runtime: E         float: is neither float or int

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.

Upgrade version of typeguard in python runtime
1 participant