-
Notifications
You must be signed in to change notification settings - Fork 246
chore: mypy設定をstrictにする #1580
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
chore: mypy設定をstrictにする #1580
The head ref may contain hidden characters: "chore--mypy\u8A2D\u5B9A\u3092strict\u306B\u3059\u308B"
Conversation
| python_version = 3.11 | ||
| show_error_codes = True | ||
| strict_equality = True | ||
| strict_optional = True | ||
| warn_redundant_casts = True | ||
| warn_return_any = True | ||
| ignore_missing_imports = True | ||
| warn_unreachable = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
残った2つの僕としての気持ちこんな感じです:
- ignore_missing_imports
- いずれオンにしたい気持ちはあるけど、恩恵と辛さを考えると難しいかも
- warn_unreachable
- 非到達かどうかは型チェックをしないとわからないこともあるのでmypyが担っているのは自然かも
- 個人的にはデッドコードに気づけるきもするので、オンにしておきたい気持ちが少しあります
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRありがとうございます!
issueのほうでもいろいろ調べて比較してくださりありがとうございました。
pysenのstrictとの相違点については私も同様の認識です。
ignore_missing_imports については、あまり調べてないですが確かにちょっと難しそうなので一旦Trueでよさそうです。
warn_unreachable についても、確かに型チェックの結果分かるというシーンもありそうだからやったほうがよさそうですね…。仰る通りです。
なので特に問題無さそうだと思いました!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
見ていただけて助かります、ありがとうございます!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates various type annotations and import groupings to support stricter mypy settings. Key changes include updating type hints for JSON and list/dictionary types, reordering and grouping imports, and incorporating NDArray type usage.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| voicevox_engine/app/routers/user_dict.py | Reorganized and grouped imports from the user dictionary module. |
| tools/merge_engine_manifest.py | Improved dict type annotations for JSON merging functionality. |
| test/utility.py | Added NDArray type annotations to better reflect numpy array usage. |
| test/unit/user_dict/test_user_dict.py | Reorganized imports to align with the updated mypy strict configuration. |
| test/unit/tts_pipeline/test_tts_engine.py | Updated list type annotations for clearer intent with AccentPhrase. |
| test/e2e/test_disable_api.py | Introduced more explicit type hints for app parameters. |
| test/e2e/single_api/tts_pipeline/test_cancellable_synthesis.py | Enhanced fixture typing with dict[str, Any] for improved type safety. |
| test/e2e/conftest.py | Updated fixture parameter types for consistency with mypy requirements. |
Files not reviewed (1)
- mypy.ini: Language not supported
|
もしよかったら @nanae772 さんもぜひコメントいただけると・・・!!! |
tarepan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
厳密な型チェックの導入により、より安全なコードを、より開発の初期段階から書けるようになっています。good work!
|
レビューありがとうございます!! マージします!! |
|
すみません、#1596 のリファクタリングをしたときに私がつけた型が根本的に間違ってて
ここは def generate_licenses_from_licenses_json(
licenses_json: list[dict[str, str]],
) -> list[License]:でした。お手数ですが直していただければマージできるようになると思います🙇♂️ |
|
お二人ともありがとうございます!! 助かります 🙇 |
内容
の解決PRです!
関連 Issue
fix #1577
その他
判断基準の詳しくはこちらへ