fix(cmd): enable mypy strict checking for cloudinit.cmd#6861
Conversation
7599c4f to
db7b5a7
Compare
|
There is an extra commit I will remove once the review is completed. This is to fix the error in the "Unit: Alternate Distros / build (pull_request)" job, which fails if the package |
holmanb
left a comment
There was a problem hiding this comment.
Thanks for this. I left some feedback.
4e7b475 to
79370b4
Compare
blackboxsw
left a comment
There was a problem hiding this comment.
A couple of minor thoughts here. Thanks a log @jaborvs for the help.
79370b4 to
0af0090
Compare
0af0090 to
68194c6
Compare
68194c6 to
d165457
Compare
|
@blackboxsw i have reviewed all the comments and implemented the suggested fixes! let me know if there is anything else you would like me to fix before proceeding with the merge. |
There was a problem hiding this comment.
Pull request overview
This PR advances GH-5445 by enabling stricter mypy checking for cloudinit.cmd modules, removing them from the check_untyped_defs=false override list and applying targeted typing/logic adjustments to satisfy strict type checking.
Changes:
- Removed
cloudinit.cmd.devel.make_mime,cloudinit.cmd.devel.net_convert, andcloudinit.cmd.mainfrom mypy overrides disablingcheck_untyped_defs. - Added/adjusted type annotations and small control-flow tweaks in
cloudinit.cmd.mainand related modules to satisfy mypy strictness. - Tightened type hints for datasource fetching and renderer configuration inputs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Removes mypy override exemptions so cmd modules are checked with check_untyped_defs=true. |
| cloudinit/stages.py | Adds a concrete return type for Init.fetch and clarifies its docstring. |
| cloudinit/net/eni.py | Broadens renderer config typing to Mapping[str, Any] for stricter typing compatibility. |
| cloudinit/cmd/main.py | Updates CLI error handling, status typing, log exporter selection, and hostname handler call args for mypy strictness. |
| cloudinit/cmd/devel/net_convert.py | Minor typing-related cleanup (import/use) to satisfy mypy for renderer typing. |
| cloudinit/cmd/devel/make_mime.py | Minor refactor of warning string assembly/variable naming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
blackboxsw
left a comment
There was a problem hiding this comment.
All looks good @jaborvs with the exception of adding that !r per copilot suggestion. Thanks for this we'll get things landed when that's in place.
b3aba4c to
c114222
Compare
|
All changes are ready! Thank you very much for all the feedback :) |
Partially-fixes: GH-5445
As part of my onboarding, I fixed the untyped defs errors found the following files:
Proposed Commit Message
Additional Context
N/A
Test Steps
N/A
Merge type