chore: exclude uv.lock from pretty-format-toml hook#48
Conversation
uv rewrites the lock file in its own canonical style on every regeneration, which is incompatible with pretty-format-toml's style, so the two formatters fight each other and the style CI job fails on every PR whenever uv.lock is regenerated without running pre-commit. Lock files are machine-generated; exclude uv.lock from the hook, as already done for check-added-large-files. Fixes daft-engine#47
Changing .pre-commit-config.yaml invalidates the cached mypy hook env in CI; the rebuilt env resolves pyarrow 24, which now ships py.typed with only partial inline typing, so dynamically generated names like pa.compute.Expression, pc.binary_length and pc.sort_indices become invisible to mypy. Add pyarrow-stubs to the hook's additional_dependencies so pyarrow typing is complete and stable regardless of pyarrow releases (matching the project dev dependencies), and fix the six strict-mode errors the full stubs surface: - annotate pa.Array with its type parameter - type schema metadata as dict[bytes | str, bytes | str] where the stubs' invariant dict parameter rejects dict[bytes, bytes] - type-ignore the intentional dynamic attributes set on LanceDataset - replace pa.compute.sort_indices with the equivalent typed Table.sort_by when restoring positional order
|
Pushed a second commit: the first CI run here revealed another latent issue. The style job caches the pre-commit environments keyed on Fix: add |
universalmind303
left a comment
There was a problem hiding this comment.
thanks @FANNG1
Fixes #47
Problem
The
styleCI job fails on every PR sincedeeb798withFile uv.lock is not pretty-formatted.uvrewrites the entire lock file in its own canonical style (4-space indent,{ url = ... }, trailing commas) every time it regenerates it, which is incompatible withpretty-format-toml's style.deeb798bumped the version and regenerateduv.lockin uv's native format, sopre-commit run --all-filesnow fails on main and on every PR based on it. The two formats are mutually exclusive — any futureuv lockrun would reintroduce the failure.Fix
Exclude
uv.lockfrom thepretty-format-tomlhook (same as the existing exclude oncheck-added-large-files). Lock files are machine-generated and machine-consumed; uv's output is already deterministic, and reformatting it only produces ~800-line noise diffs and this CI deadlock.uv.lockstays in uv's native format going forward.Verified locally: with this change,
pre-commit run --all-filespasses against main's current (uv-native)uv.lock, including theuv-lockconsistency hook.Note: #44 currently carries an unrelated
style: pretty-format uv.lockcommit as a workaround; once this merges, that commit can be dropped (or simply overwritten by the nextuv lockrun).