Skip to content

Remove mypy version pin #224

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

Closed
daviddrysdale opened this issue Dec 25, 2021 · 1 comment · Fixed by #225
Closed

Remove mypy version pin #224

daviddrysdale opened this issue Dec 25, 2021 · 1 comment · Fixed by #225
Labels

Comments

@daviddrysdale
Copy link
Owner

Commit ce13f47 pinned the version of mypy used in CI to 0.921, because 0.930 fails run_stubtest.py:

error: phonenumbers.asyoutypeformatter.REGION_CODE_FOR_NON_GEO_ENTITY is not present in stub
Stub:
MISSING
Runtime:
001
...

As a guess, something in mypy that handles local imports has changed/broken.

Hopefully this will be fixed in a future version of mypy; this issue is a reminder to check back at some point, and if the problem is fixed, to remove the version pin.

@daviddrysdale
Copy link
Owner Author

Raised python/mypy#11843

daviddrysdale added a commit that referenced this issue Dec 26, 2021
A statement like `from .local import THING` in `current.py` makes
`THING` available in the current module, but this also acts as ani
export (i.e. `current.THING` is defined).

As of version 0.930 of mypy, the `stubtest` checker wants to see a
type definition for such things, when they are ints or strings.

Add the equivalent `from .local import THING` statements into the
.pyi stub files, so `stubtest` can see the associated type definition.

For autogenerated `*data/__init__.pyi` files, this involves a change to
the metadata generation tool.

Also:
 - Fix asyoutypeformatter.py to import `REGION_CODE_FOR_NON_GEO_ENTITY`
   from `phonemetadata` (the definition) rather than `phonenumberutil`
   (a re-export).
 - Rename local loop variables to start with an underscore in
   (autogenerator for) `*data/__init__.py` so they don't look like
   things that should be exported.
 - Drop version pin (==0.921) for mypy.  Fixes #224.
daviddrysdale added a commit that referenced this issue Dec 27, 2021
A statement like `from .local import THING` in `current.py` makes
`THING` available in the current module, but this also acts as an
export (i.e. `current.THING` is defined).

As of version 0.930 of mypy, the `stubtest` checker wants to see a
type definition for such things, when they are ints or strings.

Add the equivalent `from .local import THING` statements into the
.pyi stub files, so `stubtest` can see the associated type definition.

For autogenerated `*data/__init__.pyi` files, this involves a change to
the metadata generation tool.

Also:
 - Fix asyoutypeformatter.py to import `REGION_CODE_FOR_NON_GEO_ENTITY`
   from `phonemetadata` (the definition) rather than `phonenumberutil`
   (a re-export).
 - Rename local loop variables to start with an underscore in
   (autogenerator for) `*data/__init__.py` so they don't look like
   things that should be exported.
 - Drop version pin (==0.921) for mypy.  Fixes #224.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant