Skip to content

Commit 6093d56

Browse files
committed
Select the ruff rule set explicitly, and sort imports
Ruff's default rule set is not stable across releases: 0.16 widened it, and because pyproject.toml never declared a selection, CI failed with 42 findings the moment the linter upgraded. Pinning the selection to the historical default plus import sorting makes the check depend on this repo's config rather than on ruff's changing mind. The dev dependency is bounded to match.
1 parent 822ca9f commit 6093d56

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Issues = "https://github.com/devrobotlabs/visionapi-python/issues"
4848
Changelog = "https://github.com/devrobotlabs/visionapi-python/blob/main/CHANGELOG.md"
4949

5050
[project.optional-dependencies]
51-
dev = ["pytest>=7", "mypy>=1.8", "ruff>=0.5"]
51+
dev = ["pytest>=7", "mypy>=1.8", "ruff>=0.5,<0.17"]
5252

5353
[tool.hatch.build.targets.wheel]
5454
packages = ["src/visionapi"]
@@ -60,6 +60,13 @@ testpaths = ["tests"]
6060
line-length = 100
6161
target-version = "py39"
6262

63+
# Selected explicitly rather than inherited. Ruff's default rule set is not stable across
64+
# releases — 0.16 widened it — so a library that leaves this unset gets its CI broken by a
65+
# linter upgrade that has nothing to do with its own code. This is the historical default
66+
# (pyflakes plus the pycodestyle subsets) with import sorting added.
67+
[tool.ruff.lint]
68+
select = ["E4", "E7", "E9", "F", "I"]
69+
6370
[tool.mypy]
6471
# The package supports 3.9 at runtime (see requires-python); mypy itself no longer accepts
6572
# a 3.9 target, so the type check runs against the oldest version it will take.

src/visionapi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
from .client import DEFAULT_BASE_URL, VisionAPI, __version__
1818
from .errors import (
19+
APIConnectionError,
20+
APITimeoutError,
1921
AuthenticationError,
2022
ConflictError,
21-
APIConnectionError,
2223
InsufficientCreditsError,
2324
InternalError,
2425
InvalidRequestError,
@@ -31,7 +32,6 @@
3132
SyncTimeoutError,
3233
TaskFailedError,
3334
TaskTimeoutError,
34-
APITimeoutError,
3535
UnprocessableError,
3636
UnsupportedTypeError,
3737
UsageError,

src/visionapi/_http.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import urllib.request
1818
from typing import Any, Mapping, Tuple
1919

20-
from .errors import APIConnectionError, APITimeoutError
21-
from .errors import UsageError
20+
from .errors import APIConnectionError, APITimeoutError, UsageError
2221

2322
__all__ = ["encode_multipart", "resolve_file", "send"]
2423

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
UnsupportedTypeError,
2323
UsageError,
2424
VisionAPI,
25+
WebhookSignatureError,
2526
below_confidence,
2627
missing,
2728
present,
2829
rows,
2930
unwrap,
3031
value,
3132
verify_webhook,
32-
WebhookSignatureError,
3333
)
3434

3535
KEY = "sk_live_test"

0 commit comments

Comments
 (0)