Skip to content

Commit aa9f82b

Browse files
authored
Merge pull request #27 from zph/zh-move-to-ruff
zh move to ruff
2 parents d7d5ca2 + d4b48f9 commit aa9f82b

File tree

18 files changed

+74
-48
lines changed

18 files changed

+74
-48
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ jobs:
1818
- name: initialize folders
1919
# Runbook command comes from .hermit/bin/runbook
2020
run: runbook init --skip-confirmation=true
21-
- name: Black formatting
22-
run: pre-commit run black
23-
- name: jupytext hook
24-
run: pre-commit run jupytext
25-
- name: isort hook
26-
run: pre-commit run isort
27-
- name: autoflake hook
28-
run: pre-commit run autoflake
21+
- name: Ruff formatting
22+
run: pre-commit run ruff-format
23+
- name: Ruff linting
24+
run: pre-commit run ruff
2925
- run: just test
3026
- run: echo "🍏 This job's status is ${{ job.status }}."

.pre-commit-config.yaml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
repos:
2-
- repo: https://github.com/mwouts/jupytext
3-
rev: v1.14.7 # CURRENT_TAG/COMMIT_HASH
4-
hooks:
5-
- id: jupytext
6-
args: [--pipe, black]
7-
exclude: runbook/data/_template-deno.ipynb|.*\.md|tests/.*
8-
additional_dependencies:
9-
- black==23.3.0 # Matches hook
10-
11-
- repo: https://github.com/psf/black
12-
rev: 23.3.0
13-
hooks:
14-
- id: black
15-
language_version: python3
16-
exclude: runbooks/binder/_template-deno.ipynb
17-
18-
- repo: https://github.com/pycqa/isort
19-
rev: 5.13.2
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: "d7f0995" # 2025-02-07
204
hooks:
21-
- id: isort
22-
name: isort (python)
23-
args: ["--profile", "black", "--filter-files"]
24-
25-
- repo: https://github.com/PyCQA/autoflake
26-
rev: v2.2.1
27-
hooks:
28-
- id: autoflake
29-
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variables', '--ignore-init-module-imports']
5+
- id: ruff
6+
args: [--fix]
7+
exclude: runbooks/binder/_template-deno.ipynb
8+
- id: ruff-format
9+
exclude: runbooks/binder/_template-deno.ipynb
3010

3111
- repo: local
3212
hooks:

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ build-backend = "poetry.core.masonry.api"
4747
[dependency-groups]
4848
dev = [
4949
"pytest>=8.3.4",
50+
"ruff>=0.9.5",
5051
]
5152

5253
[tool.poetry.scripts]
@@ -60,3 +61,14 @@ source = "init"
6061
# https://github.com/python-poetry/poetry/issues/927
6162
# [tool.poetry.plugins."papermill.translators"]
6263
# "typescript" = "translators:runbook.translators.TypescriptTranslator"
64+
65+
[tool.ruff]
66+
line-length = 88 # Same default as Black (adjust if needed)
67+
68+
[tool.ruff.format]
69+
quote-style = "double" # Choose "single" or "double"
70+
indent-style = "space"
71+
line-ending = "lf"
72+
73+
[tool.ruff.lint]
74+
select = ["I"]

runbook/cli/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22

33
import click
4+
45
from runbook.cli.commands import (
56
check,
67
convert,

runbook/cli/commands/check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from os import path
88

99
import click
10+
1011
from runbook.cli.completions import EditableNotebook
1112
from runbook.cli.validators import validate_runbook_file_path
1213

runbook/cli/commands/convert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from os import path
22

33
import click
4+
45
from runbook.cli.completions import EditableNotebook
56
from runbook.cli.validators import validate_runbook_file_path
67

runbook/cli/commands/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from os import path
22

33
import click
4+
45
from runbook.cli.lib import nbconvert_launch_instance
56
from runbook.cli.validators import validate_create_language, validate_template
67

@@ -16,7 +17,6 @@
1617
callback=validate_template,
1718
help="Path to the template file to use",
1819
)
19-
2020
# TODO: switch to language and template defaulting to Deno
2121
# based on operational experience at work
2222
@click.option(

runbook/cli/commands/diff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from os import path
22

33
import click
4+
45
from runbook.cli.completions import EditableNotebook
56
from runbook.cli.validators import validate_runbook_file_path
67

runbook/cli/commands/edit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from os import path
22

33
import click
4+
45
from runbook.cli.completions import EditableNotebook
56
from runbook.cli.validators import validate_runbook_file_path
67

runbook/cli/commands/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from pathlib import Path
33

44
import click
5-
from runbook.template import TEMPLATES
65

76
from runbook import __version__ as VERSION
7+
from runbook.template import TEMPLATES
88

99
RUNBOOK_CONFIG = {"version": 1, "library_version": VERSION, "directory": None}
1010

0 commit comments

Comments
 (0)