Skip to content

Commit c01f535

Browse files
conf: ai scaffolding tier1
1 parent f6bd897 commit c01f535

53 files changed

Lines changed: 459 additions & 399 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches: [ main, ray-jobs-feature ]
6+
push:
7+
branches: [ main, ray-jobs-feature ]
8+
9+
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.12'
19+
20+
- name: Install poetry
21+
run: pip install poetry
22+
23+
- name: Install dependencies
24+
run: |
25+
poetry config virtualenvs.create false
26+
poetry install --only dev
27+
28+
- name: Run ruff linter
29+
run: ruff check .

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ repos:
99
- id: check-yaml
1010
args: [--allow-multiple-documents]
1111
- id: check-added-large-files
12-
- repo: https://github.com/psf/black
13-
rev: 23.3.0
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.9.0
1414
hooks:
15-
- id: black
16-
language_version: python3.9
15+
- id: ruff
16+
args: [--fix, --exit-non-zero-on-fix]
17+
- id: ruff-format

AGENTS.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,16 @@ coverage report -m --include="path/to/changed1.py,path/to/changed2.py"
7272

7373
```sh
7474
# Format a single file
75-
black path/to/file.py
75+
ruff format path/to/file.py
7676

7777
# Check formatting without modifying
78-
black --check path/to/file.py
78+
ruff format --check path/to/file.py
79+
80+
# Lint a single file (with auto-fix)
81+
ruff check --fix path/to/file.py
82+
83+
# Lint a single file (check only, no changes)
84+
ruff check path/to/file.py
7985
```
8086

8187
### Coverage Requirements
@@ -88,7 +94,8 @@ black --check path/to/file.py
8894

8995
### Python Style
9096

91-
- **Formatter**: black (via pre-commit)
97+
- **Formatter**: ruff-format (via pre-commit)
98+
- **Linter**: ruff (pycodestyle, pyflakes)
9299
- **Naming**: snake_case for functions/variables/modules, PascalCase for classes
93100
- **Type hints**: required for function parameters and return types
94101
- **Docstrings**: Google-style (Args, Returns, Raises sections)
@@ -139,7 +146,7 @@ Pre-commit hooks enforce:
139146
- end-of-file newline
140147
- YAML validation
141148
- Large file checks
142-
- black formatting
149+
- ruff linting and formatting
143150

144151
## Cursor Rules (extended guidance)
145152

demo-notebooks/additional-demos/mnist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import torch
1919
from pytorch_lightning import LightningModule, Trainer
2020
from pytorch_lightning.callbacks.progress import TQDMProgressBar
21-
from pytorch_lightning.loggers import CSVLogger
2221
from torch import nn
2322
from torch.nn import functional as F
2423
from torch.utils.data import DataLoader, random_split

demo-notebooks/guided-demos/mnist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import torch
1919
from pytorch_lightning import LightningModule, Trainer
2020
from pytorch_lightning.callbacks.progress import TQDMProgressBar
21-
from pytorch_lightning.loggers import CSVLogger
2221
from torch import nn
2322
from torch.nn import functional as F
2423
from torch.utils.data import DataLoader, random_split

demo-notebooks/guided-demos/mnist_disconnected.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import torch
1919
from pytorch_lightning import LightningModule, Trainer
2020
from pytorch_lightning.callbacks.progress import TQDMProgressBar
21-
from pytorch_lightning.loggers import CSVLogger
2221
from torch import nn
2322
from torch.nn import functional as F
2423
from torch.utils.data import DataLoader, random_split

demo-notebooks/guided-demos/notebook-ex-outputs/mnist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import torch
1919
from pytorch_lightning import LightningModule, Trainer
2020
from pytorch_lightning.callbacks.progress import TQDMProgressBar
21-
from pytorch_lightning.loggers import CSVLogger
2221
from torch import nn
2322
from torch.nn import functional as F
2423
from torch.utils.data import DataLoader, random_split

demo-notebooks/guided-demos/preview_nbs/mnist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import torch
1919
from pytorch_lightning import LightningModule, Trainer
2020
from pytorch_lightning.callbacks.progress import TQDMProgressBar
21-
from pytorch_lightning.loggers import CSVLogger
2221
from torch import nn
2322
from torch.nn import functional as F
2423
from torch.utils.data import DataLoader, random_split

poetry.lock

Lines changed: 30 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,42 @@ webdriver-manager = "4.0.2"
7575
diff-cover = "^9.6.0"
7676
black = ">=25.11,<27.0"
7777
pre-commit = "^4.5.0"
78+
ruff = "^0.9.0"
79+
80+
[tool.ruff]
81+
target-version = "py312"
82+
line-length = 88 # Match black
83+
extend-exclude = [
84+
"*.ipynb", # Exclude Jupyter notebooks (different execution context)
85+
]
86+
87+
[tool.ruff.lint]
88+
select = [
89+
"F", # pyflakes (undefined names, unused imports)
90+
"E", # pycodestyle errors
91+
# "I", # isort (import sorting) - disabled due to circular import issues
92+
]
93+
ignore = [
94+
"E501", # line too long (handled by black/ruff-format)
95+
"E402", # module level import not at top of file
96+
"E722", # bare except (TODO: fix in future PR)
97+
"F403", # star imports (TODO: refactor in future PR)
98+
"F405", # may be undefined from star imports
99+
]
100+
101+
[tool.ruff.lint.per-file-ignores]
102+
"src/codeflare_sdk/vendored/**" = ["E", "F"] # Exclude vendored code
103+
"**/test_*.py" = ["F401", "F811", "F841"] # Allow unused imports, redefinitions, and variables in tests
104+
"**/__init__.py" = ["F401"] # Allow unused imports in __init__.py (re-exports for public API)
105+
"demo-notebooks/**/*.py" = ["F841"] # Allow unused variables in demo notebooks
106+
"tests/**/*.py" = ["F841"] # Allow unused variables in test scripts
107+
"scripts/**/*.py" = ["F841"] # Allow unused variables in scripts
108+
"ui-tests/**/*.py" = ["F821"] # Allow undefined names in UI test config
109+
110+
[tool.ruff.lint.isort]
111+
known-first-party = ["codeflare_sdk"]
112+
force-single-line = false
113+
lines-after-imports = 2
78114

79115
[tool.pytest.ini_options]
80116
filterwarnings = [

0 commit comments

Comments
 (0)