Skip to content

Commit

Permalink
Replace black with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Sep 11, 2024
1 parent 9d450f9 commit ba614a1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [python]
require_serial: true
- id: check-added-large-files
name: Check for added large files
entry: check-added-large-files
Expand Down Expand Up @@ -39,6 +33,12 @@ repos:
language: system
types: [python]
require_serial: true
- id: ruff-format
name: Format code with Ruff
entry: ruff format
language: system
types: [python]
require_serial: true
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
Expand Down
25 changes: 18 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
text = hook.read_text()

if not any(
Path("A") == Path("a") and bindir.lower() in text.lower() or bindir in text
Path("A") == Path("a")
and bindir.lower() in text.lower()
or bindir in text
for bindir in bindirs
):
continue
Expand All @@ -120,7 +122,6 @@ def precommit(session: Session) -> None:
"--show-diff-on-failure",
]
session.install(
"black",
"darglint",
"pre-commit",
"pre-commit-hooks",
Expand Down Expand Up @@ -148,16 +149,22 @@ def mypy(session: Session) -> None:
session.install("mypy", "pytest", "respx")
session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
session.run(
"mypy", f"--python-executable={sys.executable}", "noxfile.py"
)


@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".[cli]")
session.install("coverage[toml]", "pytest", "pygments", "pytest-asyncio", "respx")
session.install(
"coverage[toml]", "pytest", "pygments", "pytest-asyncio", "respx"
)
try:
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
session.run(
"coverage", "run", "--parallel", "-m", "pytest", *session.posargs
)
finally:
if session.interactive:
session.notify("coverage", posargs=[])
Expand All @@ -180,7 +187,9 @@ def coverage(session: Session) -> None:
def typeguard(session: Session) -> None:
"""Runtime type checking using Typeguard."""
session.install(".[cli]")
session.install("pytest", "typeguard", "pygments", "pytest-asyncio", "respx")
session.install(
"pytest", "typeguard", "pygments", "pytest-asyncio", "respx"
)
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)


Expand Down Expand Up @@ -221,7 +230,9 @@ def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
session.install(".")
session.install("sphinx", "sphinx-autobuild", "sphinx-click", "furo", "myst-parser")
session.install(
"sphinx", "sphinx-autobuild", "sphinx-click", "furo", "myst-parser"
)

build_dir = Path("docs", "_build")
if build_dir.exists():
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ click = { version = ">=8.0.1", optional = true }
[tool.poetry.dev-dependencies]
Pygments = ">=2.10.0"
ruff = ">=0.3.7"
black = ">=21.10b0"
coverage = {extras = ["toml"], version = ">=6.2"}
darglint = ">=1.8.1"
furo = ">=2021.11.12"
Expand Down

0 comments on commit ba614a1

Please sign in to comment.