Title: Does this lib compatible with mypy? · python-semver/python-semver · Discussion #342 · GitHub
Open Graph Title: Does this lib compatible with mypy? · python-semver/python-semver · Discussion #342
X Title: Does this lib compatible with mypy? · python-semver/python-semver · Discussion #342
Description: Does this lib compatible with mypy?
Open Graph Description: 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, mayb...
X Description: 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...
Opengraph URL: https://github.com/python-semver/python-semver/discussions/342
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Does this lib compatible with mypy?","text":"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.
\nCode example:
\nfrom semver import VersionInfo\n\n\ndef main() -> None:\n v = VersionInfo.parse(\"1.2.3\")\n print(type(v), v)\n\n\nif __name__ == \"__main__\":\n main()
\n$ mypy type-semver.py \ntype-semver.py:3:1: error: Skipping analyzing \"semver\": found module but no type hints or library stubs [import]\n from semver import VersionInfo\n ^\ntype-semver.py:3:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nFound 1 error in 1 file (checked 1 source file)
\nrequirements
\nmypy==0.910\nmypy-extensions==0.4.3\nsemver==2.13.0\ntoml==0.10.2\ntyping-extensions==3.10.0.2\n
\nmypy settings from pyproject.toml
\n[tool.mypy]\npython_version = \"3.8\"\n\ndisallow_any_unimported = true\ndisallow_any_decorated = true\ndisallow_any_generics = true\ndisallow_subclassing_any = true\ndisallow_untyped_calls = true\ndisallow_untyped_defs = true\ndisallow_incomplete_defs = true\ndisallow_untyped_decorators = true\nno_implicit_optional = true\nstrict_optional = true\n\nwarn_redundant_casts = true\nwarn_unused_ignores = true\nwarn_no_return = true\nwarn_return_any = true\nwarn_unreachable = true\n\nstrict_equality = true\nimplicit_reexport = false\n\nshow_error_context = true\nshow_column_numbers = true\nshow_error_codes = true\npretty = true\n\nwarn_unused_configs = true
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Hi @zerlok
\nthanks for your question! 👍
\nVersion 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.
\nI'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. 😉
","upvoteCount":1,"url":"https://github.com/python-semver/python-semver/discussions/342#discussioncomment-1269871"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:fbfb810f-4a56-f538-5eac-5cc6b1c8da60 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 9E2A:D2C73:BC5DA0:1098620:696FB97A |
| html-safe-nonce | e5cfd5850cea56f7a99f7b578f618552aa1c3a1b56df3f8ac92c8d3583c65009 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTJBOkQyQzczOkJDNURBMDoxMDk4NjIwOjY5NkZCOTdBIiwidmlzaXRvcl9pZCI6IjMzNDEzNjI4MjU3OTg4NTkxMzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5b6265b23bced50e742b902909ebd861adb42ed5bb8eeabd63bf5be001de45b7 |
| hovercard-subject-tag | discussion:3549926 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-semver/python-semver/342/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/003e15b0023ca01870d54456db28f0f64475dd22d31d91e18d5b9ac5b993bd7b/python-semver/python-semver/discussions/342 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/003e15b0023ca01870d54456db28f0f64475dd22d31d91e18d5b9ac5b993bd7b/python-semver/python-semver/discussions/342 |
| og:image:alt | 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, mayb... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 40ce4030a7db32193be29054756ed7f7eceec3a82973f060300035bdff8cf777 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-semver/python-semver git https://github.com/python-semver/python-semver.git |
| octolytics-dimension-user_id | 57228994 |
| octolytics-dimension-user_login | python-semver |
| octolytics-dimension-repository_id | 3375726 |
| octolytics-dimension-repository_nwo | python-semver/python-semver |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3375726 |
| octolytics-dimension-repository_network_root_nwo | python-semver/python-semver |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1cdcabe0d7ddc4be91a713d57280849e4c89f5cd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width