Add Ruff checking to replace pylint flake8 black and isort, add prek as tooling for local checks, add vscode settings - #380
Open
aryanhasgithub wants to merge 8 commits into
Open
aryanhasgithub wants to merge 8 commits into
aryanhasgithub wants to merge 8 commits into
Conversation
…as tooling for local checks, add vscode settings
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.
What does this implement/fix?
Replace Black/isort/flake8/pylint with Ruff, add prek for local hook enforcement
Summary
Consolidates the Python lint/format toolchain onto Ruff, replacing Black, isort, flake8, and pylint. Adds prek (Rust-based pre-commit) to run lint + tests automatically on every commit.
Tooling changes
pyproject.toml:[tool.black]and[tool.isort]replaced with[tool.ruff]/[tool.ruff.lint]/[tool.ruff.format].[tool.pylint.*]sections removed entirely.ruffandprekadded todevextras;black,isort,flake8,pylint,autopep8removed. Ruff'sPL(pylint-equivalent) andB(bugbear) rule sets are enabled, with anignorelist mirroring the checks previously disabled in[tool.pylint."MESSAGES CONTROL"]so effective strictness is preserved.setup.cfg: removed the now-unused[flake8]section.script/lint_flake8→script/lint_ruff: renamed and rewritten to runruff check --fix+ruff formatinstead of flake8.script/lint_black,script/lint_isort,script/lint_pylint: deleted.script/lint: updated to calllint_ruff+lint_mypyonly.mypy.ini(python_version >= 3.11→python_version = 3.13, the>=was invalid.inisyntax and was silently failing to parse).New: prek for automatic local enforcement
.pre-commit-config.yaml(new): defines two local hooks —lint(./script/lint) andtests(./script/tests,always_run: true) — both run on every commit.script/setup: now runsprek install(andpre-pushhook type) automatically as part of--devsetup, so hooks are wired up with zero manual steps for anyone setting up the repo fresh.VS Code workspace config
.vscode/settings.json: removed legacypython.linting.*keys (flake8/mypy linting,python.pythonPath,python.formatting.provider); added Ruff as the default formatter with format-on-save + fix-on-save, PylancetypeCheckingMode: "standard", andpylint.enabled: false..vscode/launch.json: switched the run config from"type": "python"/program: __main__.pyto"type": "debugpy"/module: linux_voice_assistant— fixes a real bug where launching the script directly causedlinux_voice_assistant/zeroconf.pyto shadow the installedzeroconfpackage (ModuleNotFoundError: No module named 'zeroconf.asyncio')..vscode/extensions.json: addedcharliermarsh.ruffto recommendations.Docs
AGENTS.md,README.md,.github/CONTRIBUTING.md,.github/PULL_REQUEST_TEMPLATE.md: updated all lint/test command references from./script/lint/./script/teststoprek run lint --all-files/prek run tests --all-files.CI
.github/workflows/lint.yml: removed the separatelint_black,lint_flake8,lint_isortjobs.lint_pylintjob renamed tolint_ruff, now runs./script/lint_ruff.lint_mypyjob unchanged.Minor code fixes (surfaced by Ruff/mypy during migration)
linux_voice_assistant/models.py:setattr(oww_model, "wake_word", ...)→ direct attribute assignment with# type: ignore[attr-defined]—OpenWakeWord(frompyopen_wakeword) doesn't declare this attribute; confirmed viadir()inspection that it's not part of the class's real interface, suppressed rather than removed since downstream behavior wasn't investigated further.linux_voice_assistant/entity.py: simplified a nestedif/elseintoelif(Ruff auto-fix).with/ifopeners (Ruff formatter).tests/unit/test_unit.py:import linux_voice_assistant.util as util→from linux_voice_assistant import util(Ruff import-style fix, applied consistently across all occurrences).Testing
prek run --all-filespasses (Ruff + mypy).prek run tests --all-files— all 294 tests pass.Related issue (if applicable):
Types of changes
dependenciesbugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenanceciChecklist
./script/lintpasses../script/testspasses, and tests have been added/updated undertests/where applicable.