tooling: Replace wildcard imports with explicit imports (F403/F405).#298
Merged
Conversation
BREAKING CHANGE: Wildcard imports removed across all drivers and examples. F401, F403, and F405 rules re-enabled in ruff configuration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes wildcard (import *) imports across the driver codebase to eliminate F403/F405 issues and re-enables Ruff’s unused/undefined import checks for stronger static analysis.
Changes:
- Re-enabled Ruff rules F401/F403/F405 by removing them from the global ignore list.
- Replaced wildcard imports with explicit import lists across multiple drivers and examples.
- Removed an unused
micropython.constimport by emptyingvl53l1x/const.pyand addeddaplink_bridgeREADME documentation.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Re-enables Ruff F401/F403/F405 by removing them from ignore. |
| lib/wsen-pads/wsen_pads/device.py | Replaces wildcard const/exception imports with explicit imports. |
| lib/wsen-hids/wsen_hids/device.py | Replaces wildcard const import with an explicit import list. |
| lib/vl53l1x/vl53l1x/const.py | Removes unused const import by making the module empty. |
| lib/ssd1327/ssd1327/device.py | Replaces wildcard const import with explicit imports used by the driver. |
| lib/ssd1327/ssd1327/init.py | Replaces wildcard const import with explicit re-exports. |
| lib/mcp23009e/mcp23009e/pin.py | Replaces wildcard const import with explicit imports. |
| lib/mcp23009e/mcp23009e/device.py | Replaces wildcard const import with explicit imports; trims unused I2C import. |
| lib/mcp23009e/examples/sleep_on_button.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/simon.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/reaction_timer.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/morse_code.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/menu_navigation.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/dpad_piano.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/dpad_counter.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/combination_lock.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/buttons.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/mcp23009e/examples/binary_counter.py | Replaces wildcard const import with explicit imports used in the example. |
| lib/lis2mdl/lis2mdl/device.py | Replaces wildcard const import with explicit imports. |
| lib/lis2mdl/examples/magnet_fieldForce.py | Removes unused wildcard const import from the example. |
| lib/lis2mdl/examples/magnet_compass.py | Removes unused wildcard const import from the example. |
| lib/ism330dl/ism330dl/device.py | Replaces wildcard const/exception imports with explicit imports. |
| lib/hts221/hts221/device.py | Replaces wildcard const import with explicit imports; trims unused I2C import. |
| lib/daplink_flash/daplink_flash/device.py | Replaces wildcard const import with explicit imports. |
| lib/daplink_bridge/daplink_bridge/device.py | Replaces wildcard const import with explicit imports. |
| lib/daplink_bridge/README.md | Adds usage/API documentation for the DAPLink bridge driver. |
| lib/bq27441/bq27441/device.py | Replaces wildcard const/exception imports with an explicit const import list. |
| lib/apds9960/apds9960/device.py | Replaces wildcard const/exception imports with explicit imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Deux remarques traitées dans e35921a :
Plus aucun |
|
🎉 This PR is included in version 0.2.6 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace all
from module.const import *with explicit import lists across the entire codebase. Re-enable F401, F403, and F405 rules in ruff.Changes
vl53l1x/const.pybq27441/exceptions.pyimportconstandexceptions)Drivers migrated
Closes #293
Test plan
make cipasses (196 mock tests + 271 example validations)ruff checkpasses with F401/F403/F405 re-enabled