Repository navigation
ci: pin pre-commit python to 3.14 for PEP 758 bare-except tuples - #804
Merged
Merged
Conversation
The flake-provided `pre-commit` is a Python-3.13 application, so it builds its python-language hook envs (e.g. debug-statements) with 3.13, which rejects the PEP 758 unparenthesized `except X, Y:` syntax the codebase uses (valid on Python 3.14+, and what `ruff format` emits at target py314). That produced a false `SyntaxError: multiple exception types must be parenthesized` on a bare local `pre-commit run`, even though the code is correct and CI (running pre-commit under the project's 3.14) is green. Pin `default_language_version: python: python3.14` so every python hook uses the project interpreter regardless of how pre-commit is invoked. Keeps the forward-standard syntax instead of parenthesizing (which ruff would revert). Bump alongside requires-python. Refs: #803
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
Fixes the recurring
SyntaxError: multiple exception types must be parenthesizedfalse-positive, and settles the underlying style question: keep the PEP 758 unparenthesizedexcept X, Y:form (the forward Python standard) and fix the tooling instead of the code.Why not just parenthesize?
except X, Y:(no parens) is PEP 758, valid on Python 3.14+ and permanently going forward (verified:ruff formatstrips added parens at bothtarget py314andpy315). The repo targets py314, so ruff emits this form — parenthesizing toexcept (X, Y):fights the formatter and would be reverted on everyruff format.requires-python >=3.14means consumers are 3.14+ anyway. So the syntax is correct and future-proof; only pre-3.14 parsers choke on it.Root cause + fix
The flake-provided
pre-commitis itself a Python-3.13 app, so it builds itsdebug-statementshook env with 3.13 → rejects the syntax on a bare localpre-commit run. CI is green because it runs pre-commit under the project's 3.14.Fix — pin the hook interpreter:
Verified: after the pin, a bare flake
pre-commit run --all-filesis fully green (thedebug-statementshook now builds its env with 3.14). No code changed; the two files using the syntax (tests/conftest.py,packages/vig-utils/tests/test_claude_ssot.py) stay as-is.Notes
assets/workspace/.pre-commit-config.yamlgets the same pin via sync-manifest.requires-pythonon future Python upgrades.vig-os/meta/docs).Refs: #803