Repository navigation
fix(audio): probe audioread without an unused import (unblocks ruff-check on main) - #3987
Merged
Merged
Conversation
The bounded media-fetch change (#3970) stopped decoding audio through audioread directly but left `import audioread` in place purely to set AUDIOREAD_AVAILABLE. Ruff flags the now-unused import (F401), so `format/check.sh` — and therefore the `ruff-check` CI job — fails on main for every open pull request. Probe the distribution with importlib.util.find_spec instead of importing it. The availability flag keeps its meaning (an absent package still reports False) and the module no longer shadows the check with an unused binding.
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.
Why
ruff-checkhas been failing onmainsince #3970/#3980, so every open PR inherits a red required check:The bounded media-fetch change stopped decoding audio through
audioreadbut keptimport audioreadonly to setAUDIOREAD_AVAILABLE.Change
Probe the distribution with
importlib.util.find_spec("audioread")instead of importing it.AUDIOREAD_AVAILABLEkeeps its meaning: an absent package still reportsFalse.format/check.shand theruff-checkjob pass.ruff check gptqmodel docs/eora tests setup.py→ All checks passed, andAUDIOREAD_AVAILABLEreportsFalsein this environment (package absent), matching the previousImportErrorpath.Scope
One file, 5 lines. No behaviour change for installed
audioreadusers: the flag isTrueeither way, and the decode path already routes through the bounded fetch helper.