Skip to content

chore: exclude uv.lock from pretty-format-toml hook#48

Merged
universalmind303 merged 2 commits into
daft-engine:mainfrom
FANNG1:chore/exclude-uv-lock-from-toml-hook
Jul 3, 2026
Merged

chore: exclude uv.lock from pretty-format-toml hook#48
universalmind303 merged 2 commits into
daft-engine:mainfrom
FANNG1:chore/exclude-uv-lock-from-toml-hook

Conversation

@FANNG1

@FANNG1 FANNG1 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #47

Problem

The style CI job fails on every PR since deeb798 with File uv.lock is not pretty-formatted.

uv rewrites the entire lock file in its own canonical style (4-space indent, { url = ... }, trailing commas) every time it regenerates it, which is incompatible with pretty-format-toml's style. deeb798 bumped the version and regenerated uv.lock in uv's native format, so pre-commit run --all-files now fails on main and on every PR based on it. The two formats are mutually exclusive — any future uv lock run would reintroduce the failure.

Fix

Exclude uv.lock from the pretty-format-toml hook (same as the existing exclude on check-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.lock stays in uv's native format going forward.

Verified locally: with this change, pre-commit run --all-files passes against main's current (uv-native) uv.lock, including the uv-lock consistency hook.

Note: #44 currently carries an unrelated style: pretty-format uv.lock commit as a workaround; once this merges, that commit can be dropped (or simply overwritten by the next uv lock run).

fanng added 2 commits July 3, 2026 18:32
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
@FANNG1

FANNG1 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Pushed a second commit: the first CI run here revealed another latent issue. The style job caches the pre-commit environments keyed on .pre-commit-config.yaml, so touching that file rebuilt the mypy hook env, which resolved the just-released pyarrow 24 — it now ships py.typed with only partial inline typing, making dynamically generated names (pa.compute.Expression, pc.binary_length, pc.sort_indices) invisible to mypy. Any future config change would have hit the same wall.

Fix: add pyarrow-stubs to the mypy hook's additional_dependencies (matching the project dev deps) so pyarrow typing is complete and independent of pyarrow releases, and fix the six strict-mode errors the full stubs surface (details in the commit message). Full pre-commit suite and the whole test suite (279 passed) are green locally.

@universalmind303 universalmind303 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @FANNG1

@universalmind303 universalmind303 merged commit f88f1d1 into daft-engine:main Jul 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI style job fails on every PR: uv.lock conflicts with pretty-format-toml hook

2 participants