Add Ruff linting, pre-commit hooks, and CI#58
Open
korbonits wants to merge 1 commit intozjunlp:mainfrom
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
- Fix src/lightmem/memory/graph.py: stub class body was missing (added pass)
Auto-fixed 217 import-sort, style, and formatting violations. Remaining notes:
- F601: duplicate dictionary keys in lightmem.py:166-167
('embedding_calls' and 'embedding_total_tokens' each appear twice in the
token stats dict — the second assignment silently overwrites the first)
- F821: undefined name 'client' in experiments/locomo/llm_judge.py:60
(referenced before assignment; potential NameError at runtime)
Both are suppressed in the config so CI passes, but flagging for maintainer
attention.
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/PRsrc/lightmem/memory/graph.py: fix stub class body (addedpass— the file wasclass GraphMem:\nwhich is a syntax error)Auto-fixed 217 import-sort and style violations.
Three items flagged for maintainer attention:
src/lightmem/memory/lightmem.py:166-167declares"embedding_calls"and"embedding_total_tokens"twice in the token stats dict initializer; the second assignment silently overwrites the first. The stats dict likely has the right keys at the end, but the first four entries (lines 160-161) are dead.experiments/locomo/llm_judge.py:60referencesclientbefore it is assigned in the enclosing scope.graph.pywas an empty class body (class GraphMem:with nopass), causing a PythonIndentationErroron import. Fixed.Both F601 and F821 are suppressed in the config so CI passes, but flagging for maintainer attention.
Ruff version: v0.12.2