Skip to content

Commit b11a9e9

Browse files
chore: replace Black with Ruff for formatting (#58)
This replaces the black formatter with the one built into ruff. Ruff is mostly the same style as black for our use case.
1 parent 6e9e9ac commit b11a9e9

8 files changed

Lines changed: 13 additions & 17 deletions

File tree

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
- name: Install Dependencies
4444
run: poetry install
4545

46-
- name: Run Black
47-
run: poetry run task black --check
46+
- name: Run format
47+
run: poetry run task format --check
4848

4949
- name: Run safety
5050
run: poetry export -f requirements.txt | poetry run safety check --bare --stdin

lib/binarylane/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Contains shared errors types that can be raised from API functions """
1+
"""Contains shared errors types that can be raised from API functions"""
22

33
from __future__ import annotations
44

lib/binarylane/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Contains some shared types for properties """
1+
"""Contains some shared types for properties"""
22

33
from __future__ import annotations
44

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ bl = "binarylane.console.__main__:main"
1818

1919
[tool.poetry.group.dev.dependencies]
2020
taskipy = "^1.10.3"
21-
black = "*"
2221
mypy = "*"
2322
types-python-dateutil = "^2.8.19"
2423
pytest = "^7.2.0"
@@ -29,24 +28,21 @@ ruff = "^0.9.6"
2928

3029
[tool.taskipy.tasks]
3130
generate = "python scripts/generate.py"
32-
black = "black ."
31+
format = "ruff format ."
3332
isort = "ruff check --select I . --fix"
3433
mypy = "mypy ."
3534
ruff = "ruff check src"
3635
safety = "poetry export -f requirements.txt | safety check --bare --stdin"
3736
test = "pytest tests"
38-
check = "task isort && task black && task mypy && task ruff && task test && task safety"
39-
40-
[tool.black]
41-
line-length = 120
42-
target_version = ["py37"]
37+
check = "task isort && task format && task mypy && task ruff && task test && task safety"
4338

4439
[tool.ruff]
4540
# Always generate Python 3.8-compatible code.
4641
target-version = "py38"
4742
line-length = 120
4843
exclude = [
4944
"api", # generated command classes
45+
".venv"
5046
]
5147

5248
[tool.ruff.lint]

src/binarylane/console/parser/list_attribute.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def configure(self, parser: Parser) -> None:
7575
parser.add_group_help(title=self.title, description=self.description, entries=usage_descriptions)
7676

7777
parser.add_keyword(self.keyword)
78-
parser.add_argument(self.attribute_name, type=str, nargs=argparse.PARSER, help=argparse.SUPPRESS).required = (
79-
False
80-
)
78+
parser.add_argument(
79+
self.attribute_name, type=str, nargs=argparse.PARSER, help=argparse.SUPPRESS
80+
).required = False
8181

8282
def _create_singlestore_action(self, **kwargs: Any) -> argparse.Action:
8383
action = SingleStoreAction(**kwargs)

src/binarylane/pycompat/actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" BooleanOptionalAction imported from 3.9 """
1+
"""BooleanOptionalAction imported from 3.9"""
22

33
from __future__ import annotations
44

tests/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
""" This package contains some "frozen" and/or simplified replicas of BinaryLane API model objects """
1+
"""This package contains some "frozen" and/or simplified replicas of BinaryLane API model objects"""
22

33
from __future__ import annotations

0 commit comments

Comments
 (0)