Skip to content

Commit bc0c754

Browse files
committed
remove black as dev dependency and upgrade ruff
1 parent 4141bf2 commit bc0c754

6 files changed

Lines changed: 16 additions & 39 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ repos:
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
9-
- repo: https://github.com/psf/black
10-
rev: "24.4.2"
11-
hooks:
12-
- id: black
9+
1310
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.5.1
11+
rev: v0.15.12
1512
hooks:
16-
- id: ruff
13+
- id: ruff-check
14+
- id: ruff-format
15+
1716
- repo: https://github.com/RobertCraigie/pyright-python
1817
rev: v1.1.370
1918
hooks:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- Remove `black` from `pyproject.toml` and `tasks.py`
11+
- Upgrade `ruff` to `0.15.12`
12+
1013
### Changed
1114

1215
- Upgrade Docker image to use python:3.12-slim-bookworm

docs/Developer-Setup.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ The key part is the symlink to `.venv` so that LSP-pyright and other tool can au
4949
- When doing some JS, you obviously need a Node.JS as well
5050
- [hatch](https://pypi.org/project/hatch/) installed globally
5151
- [Visual Studio Code](https://github.com/microsoft/vscode) with following extensions (more or less related to Python development)
52-
- Black Formater (Microsoft)
5352
- Dev Containers (Microsoft)
5453
- Docker (Microsoft)
5554
- Excalidraw (pomdtr)
@@ -77,12 +76,6 @@ This additional Hatch config section ensures that all virtual environments (the
7776
On every project, create a local `.vscode/settings.json` to automatically format your code (adjust `typeCheckingMode` depending on your project):
7877
``` json
7978
{
80-
"[python]": {
81-
"editor.defaultFormatter": "ms-python.black-formatter",
82-
"editor.codeActionsOnSave": {
83-
"source.organizeImports": "explicit"
84-
}
85-
},
8679
"python.analysis.typeCheckingMode": "strict",
8780
"eslint.validate": ["javascript", "typescript", "vue"],
8881
"eslint.workingDirectories": [{ "mode": "auto" }],

docs/pyproject.toml.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version must be dynamic and set once in code. `module.__about__` usually.
2020

2121
### Linting
2222

23-
- Black (latest available version)
23+
- Ruff (latest available version)
2424
- Ruff for import sorting (isort-like) and many other checks
2525
- Dedicated hatch environment
26-
- Black and ruff configuration so those works without hatch as well
27-
- Scripts for just black and just ruff checking
28-
- Scripts for black fixing and ruf fixing (accepts params)
26+
- Ruff configuration so those works without hatch as well
27+
- Scripts for just ruff checking
28+
- Scripts for ruff fixing (accepts params)
2929
- Scripts for global checking and fixing
3030
- Sample ruff configuration
3131

@@ -42,4 +42,4 @@ Version must be dynamic and set once in code. `module.__about__` usually.
4242
- Dedicated hatch environment
4343
- Hatch environment matrix to easily tests on multiple python versions
4444
- pytest and coverage configuration so those works without hatch as well
45-
- Scripts for running tests (accepts params), running with coverage and reporting
45+
- Scripts for running tests (accepts params), running with coverage and reporting

pyproject.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ scripts = [
2020
"invoke==2.2.0",
2121
]
2222
lint = [
23-
"black==24.4.2",
24-
"ruff==0.5.1",
23+
"ruff==0.15.12",
2524
]
2625
check = [
2726
"pyright==1.1.370",
@@ -75,10 +74,8 @@ skip-install = false
7574
features = ["scripts", "lint"]
7675

7776
[tool.hatch.envs.lint.scripts]
78-
black = "inv lint-black --args '{args}'"
7977
ruff = "inv lint-ruff --args '{args}'"
8078
all = "inv lintall --args '{args}'"
81-
fix-black = "inv fix-black --args '{args}'"
8279
fix-ruff = "inv fix-ruff --args '{args}'"
8380
fixall = "inv fixall --args '{args}'"
8481

@@ -89,9 +86,6 @@ features = ["scripts", "check"]
8986
pyright = "inv check-pyright --args '{args}'"
9087
all = "inv checkall --args '{args}'"
9188

92-
[tool.black]
93-
line-length = 88
94-
target-version = ['py311']
9589

9690
[tool.ruff]
9791
target-version = "py312"

tasks.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ def coverage(ctx: Context, args: str = "", *, html: bool = False):
4242
report_cov(ctx, html=html)
4343

4444

45-
@task(optional=["args"], help={"args": "black additional arguments"})
46-
def lint_black(ctx: Context, args: str = "."):
47-
args = args or "." # needed for hatch script
48-
ctx.run("black --version", pty=use_pty)
49-
ctx.run(f"black --check --diff {args}", pty=use_pty)
5045

5146

5247
@task(optional=["args"], help={"args": "ruff additional arguments"})
@@ -59,13 +54,12 @@ def lint_ruff(ctx: Context, args: str = "."):
5954
@task(
6055
optional=["args"],
6156
help={
62-
"args": "linting tools (black, ruff) additional arguments, typically a path",
57+
"args": "linting tools (ruff) additional arguments, typically a path",
6358
},
6459
)
6560
def lintall(ctx: Context, args: str = "."):
6661
"""Check linting"""
6762
args = args or "." # needed for hatch script
68-
lint_black(ctx, args)
6963
lint_ruff(ctx, args)
7064

7165

@@ -82,11 +76,6 @@ def checkall(ctx: Context, args: str = ""):
8276
check_pyright(ctx, args)
8377

8478

85-
@task(optional=["args"], help={"args": "black additional arguments"})
86-
def fix_black(ctx: Context, args: str = "."):
87-
"""fix black formatting"""
88-
args = args or "." # needed for hatch script
89-
ctx.run(f"black {args}", pty=use_pty)
9079

9180

9281
@task(optional=["args"], help={"args": "ruff additional arguments"})
@@ -99,12 +88,11 @@ def fix_ruff(ctx: Context, args: str = "."):
9988
@task(
10089
optional=["args"],
10190
help={
102-
"args": "linting tools (black, ruff) additional arguments, typically a path",
91+
"args": "linting tools ( ruff) additional arguments, typically a path",
10392
},
10493
)
10594
def fixall(ctx: Context, args: str = "."):
10695
"""Fix everything automatically"""
10796
args = args or "." # needed for hatch script
108-
fix_black(ctx, args)
10997
fix_ruff(ctx, args)
11098
lintall(ctx, args)

0 commit comments

Comments
 (0)