-
Hello, I'm trying to use python-semver with mypy, but I'm getting an error from mypy. It seems like typings and annotations were not provided for semver lib build. I don't know if it is a bug, maybe I've installed the lib incorrectly? Thanks for help. Code example: from semver import VersionInfo
def main() -> None:
v = VersionInfo.parse("1.2.3")
print(type(v), v)
if __name__ == "__main__":
main() $ mypy type-semver.py
type-semver.py:3:1: error: Skipping analyzing "semver": found module but no type hints or library stubs [import]
from semver import VersionInfo
^
type-semver.py:3:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file) requirements
mypy settings from [tool.mypy]
python_version = "3.8"
disallow_any_unimported = true
disallow_any_decorated = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_return_any = true
warn_unreachable = true
strict_equality = true
implicit_reexport = false
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
warn_unused_configs = true |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @zerlok thanks for your question! 👍 Version 2 does not have any type hints. They were introduced in the upcoming (but not yet released) version 3. See issue #213 for more details. I'm not yet familiar with type hinting, just get accustomed to it ATM. One solution for version 2 could be |
Beta Was this translation helpful? Give feedback.
Hi @zerlok
thanks for your question! 👍
Version 2 does not have any type hints. They were introduced in the upcoming (but not yet released) version 3. See issue #213 for more details.
I'm not yet familiar with type hinting, just get accustomed to it ATM. One solution for version 2 could be
stubgen
(integrated in mypy) to create a first skeleton. However, it still needs manual editing. I take pull requests. 😉