Add Ruff linting, pre-commit hooks, and CI#145
Open
Conversation
- Add [tool.ruff] config to pyproject.toml (E/F/I rules, line-length 120) - Add .pre-commit-config.yaml with ruff + ruff-format hooks - Add .github/workflows/lint.yml CI job via uv Auto-fixed 60 import-sort and style violations. Remaining notes: - F821: `prev_rays_overlap` in pi3/pipe/pi3x_vo.py:69 is used before it is defined (it is assigned at line 130); similar overlap variables are initialised to None at the top of the loop but this one is not — may be a latent NameError on the first iteration when prev_local_depth_overlap is set but prev_rays_overlap is not - F401: `unbind` in pi3/models/layers/attention.py is imported but all call sites are commented out; added # noqa: F401
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
Adds Ruff linting + CI enforcement to catch style and correctness issues on every PR.
Changes:
pyproject.toml: add[tool.ruff]config (E/F/I rules, line-length 120, notebooks excluded).pre-commit-config.yaml: ruff + ruff-format hooks.github/workflows/lint.yml: lint job viauvon push/PRAuto-fixed 60 violations (unsorted imports, f-string placeholders, style).
Two items flagged for maintainer attention:
prev_rays_overlapinpi3/pipe/pi3x_vo.py:69is referenced inside theif ... prev_local_depth_overlap is not Nonebranch, butprev_rays_overlapis never initialized toNoneat the top of the loop (unlikeprev_local_depth_overlapandprev_aligned_poses_overlap). On the first iteration whereprev_local_depth_overlapis set, accessingprev_rays_overlapwould raiseNameError. Added F821 to the ignore list so CI passes, but this is worth a second look.unbindimport —xformers.ops.unbindis imported inpi3/models/layers/attention.pybut all call sites are commented out (# q, k, v = unbind(qkv, 2)). Added# noqa: F401.Ruff version: v0.12.2