Skip to content

Commit 781cf2b

Browse files
Adds ruff config
1 parent 849872c commit 781cf2b

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: astral-sh/ruff-action@v3
15+
with:
16+
args: check
17+
- uses: astral-sh/ruff-action@v3
18+
with:
19+
args: format --check

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.1
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@ Use `--yes` to skip the confirmation prompt.
351351

352352
Contributions are welcome. Please read our contributing guidelines before submitting pull requests.
353353

354+
### Development Setup
355+
356+
1. Install the package with dev dependencies:
357+
358+
```bash
359+
pip install -e ".[dev]"
360+
```
361+
362+
2. Install pre-commit hooks:
363+
364+
```bash
365+
pre-commit install
366+
```
367+
368+
This enables automatic linting and formatting checks (via [Ruff](https://docs.astral.sh/ruff/)) on every commit.
369+
370+
To run the checks manually against all files:
371+
372+
```bash
373+
pre-commit run --all-files
374+
```
375+
376+
### Submitting Changes
377+
354378
1. Fork the repository
355379
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
356380
3. Commit your changes (`git commit -m 'Add amazing feature'`)

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ cli = [
3232
"pulumi-gcp>=9.0",
3333
"pulumi-command>=1.0",
3434
]
35+
dev = [
36+
"pre-commit",
37+
"ruff",
38+
]
3539
demo = [
3640
"jax",
3741
"keras",
@@ -53,3 +57,11 @@ requires = [
5357
"twine",
5458
]
5559
build-backend = "hatchling.build"
60+
61+
[tool.ruff]
62+
indent-width = 2
63+
line-length = 80
64+
65+
[tool.ruff.lint]
66+
select = ["B", "E", "F", "N", "PYI", "T20", "TID", "SIM", "W", "I", "NPY"]
67+
ignore = ["E501"]

0 commit comments

Comments
 (0)