Skip to content

Commit

Permalink
chore: tightened ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Feb 15, 2025
1 parent 1563836 commit 4cac81d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
6 changes: 4 additions & 2 deletions kreuzberg/_tesseract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import Enum
from functools import partial
from os import PathLike
from typing import Literal, TypeVar, Union, cast
from typing import Final, Literal, TypeVar, Union, cast

from anyio import CapacityLimiter, create_task_group, to_process
from anyio import Path as AsyncPath
Expand All @@ -23,6 +23,8 @@
if sys.version_info < (3, 11): # pragma: no cover
from exceptiongroup import ExceptionGroup # type: ignore[import-not-found]

MINIMAL_SUPPORTED_TESSERACT_VERSION: Final[int] = 5

version_ref = {"checked": False}

T = TypeVar("T", bound=Union[Image, PathLike[str], str])
Expand Down Expand Up @@ -198,7 +200,7 @@ async def validate_tesseract_version() -> None:
command = ["tesseract", "--version"]
result = await run_sync(subprocess.run, command, capture_output=True)
version_match = re.search(r"tesseract\s+v?(\d+)", result.stdout.decode())
if not version_match or int(version_match.group(1)) < 5:
if not version_match or int(version_match.group(1)) < MINIMAL_SUPPORTED_TESSERACT_VERSION:
raise MissingDependencyError("Tesseract version 5 or above is required.")

version_ref["checked"] = True
Expand Down
43 changes: 21 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kreuzberg"
version = "1.7.0"
version = "2.0.0"
description = "A text extraction library supporting PDFs, images, office documents and more"
readme = "README.md"
keywords = [
Expand Down Expand Up @@ -75,41 +75,40 @@ format.docstring-code-line-length = 120
format.docstring-code-format = true
lint.select = [ "ALL" ]
lint.ignore = [
"ANN401", # Dynamically typed ANY
"ASYNC110", # Use Event instead of sleep in async loop
"C901", # Cognitive Complexity
"COM812", # Conflicts with formatter
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"D205", # 1 blank line required between summary line and description
"E501", # Line too long, handled by ruff format
"EM", # Exception messages,
"FBT", # Boolean-typed positional argument in function definition
"FIX", # We allow todo and fixme comments
"ISC001", # Conflicts with formatter
"PD011", # Creates false positives
"PGH003", # Required specific mypy ignores
"PLR0911", # Pylint too many return statements
"PLR0912", # Pylint too many branches
"PLR0913", # Pylint too many arguments
"PLR2004", # Magic variables, we allow them
"TD", # We allow todo and fixme comments
"TRY", # Try except block, rules are too strict
"ANN401", # Dynamically typed ANY for kwargs
"COM812", # Conflicts with formatter
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"D205", # 1 blank line required between summary line and description
"E501", # Line too long, handled by ruff format
"EM", # Exception messages,
"FBT", # Boolean-typed positional argument in function definition
"FIX", # We allow todo and fixme comments
"ISC001", # Conflicts with formatter
"TD", # We allow todo and fixme comments
"TRY", # Try except block, rules are too strict
]
lint.per-file-ignores."tests/**/*.*" = [
"ARG001",
"D",
"N815",
"PGH003",
"PLR2004",
"PT006",
"PT007",
"PT013",
"RUF012",
"S",
]
lint.isort.known-first-party = [ "kreuzberg", "tests" ]
lint.mccabe.max-complexity = 15
lint.pydocstyle.convention = "google"

lint.pylint.max-args = 10
lint.pylint.max-branches = 15
lint.pylint.max-returns = 10

[tool.pyproject-fmt]
keep_full_version = true
max_supported_python = "3.13"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4cac81d

Please sign in to comment.