[py] Fix remaining mypy errors and enable CI for type checking#16837
[py] Fix remaining mypy errors and enable CI for type checking#16837iampopovich merged 1 commit intoSeleniumHQ:trunkfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
Hi @cgoldberg, I'm trying to understand why you made Technically this even applies to I'd recommend to move -- |
|
Yea, that's fair. I'll move them to dev dependencies. |
User description
🔗 Related Issues
Fixes #15697
Supersedes #16827
💥 What does this PR do?
This PR fixes the rest of the type annotation errors across the Python bindings. You can now run
mypy(tox -e typecheck) and there are zero errors with the current rule set.This PR also:
typingjob inci-pyto fail if any type errors are encountered in PR's or in trunk🔧 Implementation Notes
There are still some additional
mypyrules we can enable inpyproject.tomlto make type checking stricter and mandatory.This PR also adds some instance variables on some Service classes to make them similar to the others, and cleans up docstrings and removes a deprecation messages that shouldn't be there.
🔄 Types of changes
PR Type
Bug fix, Tests
Description
Fix type annotation errors across Python bindings for mypy compliance
Add type stubs as dependencies and enable strict mypy rules
Store options and service as instance variables in WebDriver classes
Add null checks for global devtools module and command executor validation
Clean up docstrings and remove incorrect deprecation warnings
Diagram Walkthrough
File Walkthrough
16 files
Remove optional union from ignore_proxy parameterUpdate docstring and store options as instance variableRemove optional union from ignore_proxy parameterMake parameters required and store options as instance variableRemove optional union from ignore_proxy parameterStore service and options as instance variablesRemove optional union and add type ignore commentStore options as instance variable and update docstringsStore options as instance variable and clean docstringsFix type annotations and add validation for client configRemove type ignore comment from websocket importRemove optional union from ignore_proxy parameterReorder parameters and store options as instance variableAdd type ignore comment for dynamic method assignmentAdd type annotations and exception handlingAdd type annotations and exception handling3 files
Add null checks for global devtools moduleAdd safety check before accessing service attributeAdd null checks for CDP version and command executor validation2 files
Make type checking fail on errors in CIUpdate typecheck environment to use requirements4 files
Add type stub packages as dependenciesMove type stubs to main dependencies and enable strict mypy rulesAdd type stub packages to requirementsUpdate locked versions with type stub dependencies