Skip to content

Commit 1c76085

Browse files
authored
Switch from black to ruff-format. (#478)
1 parent 14bc796 commit 1c76085

17 files changed

+42
-23
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@ repos:
4444
rev: v1.2.0
4545
hooks:
4646
- id: sort-all
47-
- repo: https://github.com/psf/black
48-
rev: 23.10.1
49-
hooks:
50-
- id: black
5147
- repo: https://github.com/astral-sh/ruff-pre-commit
5248
rev: v0.1.4
5349
hooks:
5450
- id: ruff
5551
args: [--unsafe-fixes]
52+
- id: ruff-format
5653
- repo: https://github.com/dosisod/refurb
5754
rev: v1.22.1
5855
hooks:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ______________________________________________________________________
1717
[![image](https://img.shields.io/github/actions/workflow/status/pytask-dev/pytask/main.yml?branch=main)](https://github.com/pytask-dev/pytask/actions?query=branch%3Amain)
1818
[![image](https://codecov.io/gh/pytask-dev/pytask/branch/main/graph/badge.svg)](https://app.codecov.io/gh/pytask-dev/pytask)
1919
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pytask-dev/pytask/main.svg)](https://results.pre-commit.ci/latest/github/pytask-dev/pytask/main)
20-
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
20+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
2121

2222
<!-- Keep in sync with docs/source/index.md -->
2323

docs/source/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
2424
- {pull}`472` adds `is_product` to {meth}`PNode.load`.
2525
- {pull}`473` adds signatures to nodes which decouples an identifier from a name.
2626
- {pull}`477` updates the PyPI action.
27+
- {pull}`478` replaces black with ruff-format.
2728

2829
## 0.4.1 - 2023-10-11
2930

docs/source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![image](https://img.shields.io/github/actions/workflow/status/pytask-dev/pytask/main.yml?branch=main)](https://github.com/pytask-dev/pytask/actions?query=branch%3Amain)
1212
[![image](https://codecov.io/gh/pytask-dev/pytask/branch/main/graph/badge.svg)](https://app.codecov.io/gh/pytask-dev/pytask)
1313
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pytask-dev/pytask/main.svg)](https://results.pre-commit.ci/latest/github/pytask-dev/pytask/main)
14-
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1515

1616
## Features
1717

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies:
2323
- typing_extensions
2424

2525
# Misc
26-
- black
2726
- deepdiff
2827
- ipywidgets
2928
- jupyterlab
@@ -35,6 +34,7 @@ dependencies:
3534
- pytest-cov
3635
- pytest-env
3736
- pytest-xdist
37+
- ruff
3838
- syrupy
3939
- tabulate
4040
- tox

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ ignore = [
110110
"D416",
111111
"D417",
112112
# Others.
113+
"ISC001",
113114
"S101", # raise errors for asserts.
114115
"ANN101", # type annotating self
115116
"ANN102", # type annotating cls

src/_pytask/click.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ class ColoredGroup(DefaultGroup):
6767
"""A command group with colored help pages."""
6868

6969
def format_help(
70-
self: DefaultGroup, ctx: click.Context, formatter: Any # noqa: ARG002
70+
self: DefaultGroup,
71+
ctx: click.Context,
72+
formatter: Any, # noqa: ARG002
7173
) -> None:
7274
"""Format the help text."""
7375
highlighter = _OptionHighlighter()
@@ -116,7 +118,9 @@ class ColoredCommand(click.Command):
116118
"""A command with colored help pages."""
117119

118120
def format_help(
119-
self: click.Command, ctx: click.Context, formatter: Any # noqa: ARG002
121+
self: click.Command,
122+
ctx: click.Context,
123+
formatter: Any, # noqa: ARG002
120124
) -> None:
121125
"""Format the help text."""
122126
console.print(

src/_pytask/config_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121

2222
def set_defaults_from_config(
23-
context: click.Context, param: click.Parameter, value: Any # noqa: ARG001
23+
context: click.Context,
24+
param: click.Parameter, # noqa: ARG001
25+
value: Any,
2426
) -> Path | None:
2527
"""Set the defaults for the command-line interface from the configuration."""
2628
# pytask will later walk through all configuration hooks, even the ones not related

src/_pytask/debugging.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None:
5959

6060

6161
def _pdbcls_callback(
62-
ctx: click.Context, name: str, value: str | None # noqa: ARG001
62+
ctx: click.Context, # noqa: ARG001
63+
name: str, # noqa: ARG001
64+
value: str | None,
6365
) -> tuple[str, str] | None:
6466
"""Validate the debugger class string passed to pdbcls."""
6567
message = "'pdbcls' must be like IPython.terminal.debugger:TerminalPdb"
@@ -259,7 +261,10 @@ def get_stack(self, f: FrameType, t: TracebackType) -> tuple[str, int]:
259261

260262
@classmethod
261263
def _init_pdb(
262-
cls, method: str, *args: Any, **kwargs: Any # noqa: ARG003
264+
cls,
265+
method: str,
266+
*args: Any, # noqa: ARG003
267+
**kwargs: Any,
263268
) -> pdb.Pdb:
264269
"""Initialize PDB debugging, dropping any IO capturing."""
265270
if cls._pluginmanager is None:

src/_pytask/parameters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272

7373

7474
def _database_url_callback(
75-
ctx: Context, name: str, value: str | None # noqa: ARG001
75+
ctx: Context, # noqa: ARG001
76+
name: str, # noqa: ARG001
77+
value: str | None,
7678
) -> URL | None:
7779
"""Check the url for the database."""
7880
# Since sqlalchemy v2.0.19, we need to shortcircuit here.

0 commit comments

Comments
 (0)