Skip to content

Commit 48c0a37

Browse files
Adds ruff config
1 parent 97f01a9 commit 48c0a37

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-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.11.12
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
@@ -401,6 +401,30 @@ destroy Pulumi-managed resources.
401401

402402
Contributions are welcome. Please read our contributing guidelines before submitting pull requests.
403403

404+
### Development Setup
405+
406+
1. Install the package with dev dependencies:
407+
408+
```bash
409+
pip install -e ".[dev]"
410+
```
411+
412+
2. Install pre-commit hooks:
413+
414+
```bash
415+
pre-commit install
416+
```
417+
418+
This enables automatic linting and formatting checks (via [Ruff](https://docs.astral.sh/ruff/)) on every commit.
419+
420+
To run the checks manually against all files:
421+
422+
```bash
423+
pre-commit run --all-files
424+
```
425+
426+
### Submitting Changes
427+
404428
1. Fork the repository
405429
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
406430
3. Commit your changes (`git commit -m 'Add amazing feature'`)

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ classifiers = [
1414
"Operating System :: OS Independent",
1515
]
1616
dependencies = [
17+
"absl-py",
1718
"cloudpickle",
1819
"numpy",
1920
"keras",
@@ -32,6 +33,10 @@ cli = [
3233
"pulumi-command>=1.0",
3334
"google-cloud-tpu>=1.0",
3435
]
36+
dev = [
37+
"pre-commit",
38+
"ruff",
39+
]
3540
demo = [
3641
"jax",
3742
"keras",
@@ -53,3 +58,11 @@ requires = [
5358
"twine",
5459
]
5560
build-backend = "hatchling.build"
61+
62+
[tool.ruff]
63+
indent-width = 2
64+
line-length = 80
65+
66+
[tool.ruff.lint]
67+
select = ["B", "E", "F", "N", "PYI", "T20", "TID", "SIM", "W", "I", "NPY"]
68+
ignore = ["E501"]

0 commit comments

Comments
 (0)