-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
114 lines (103 loc) · 3.88 KB
/
Copy pathpyproject.toml
File metadata and controls
114 lines (103 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
[build-system]
requires = ["uv_build>=0.11.19,<0.12.0"]
build-backend = "uv_build"
[project]
name = "xkc-kl200-python"
version = "7.0.0"
description = "A typed Python library for controlling the XKC-KL200 UART laser distance sensor."
readme = "README.md"
authors = [
{ name = "sam0rr", email = "samor140@hotmail.com" },
]
requires-python = ">=3.13"
dependencies = [
"pyserial>=3.5",
]
[dependency-groups]
dev = [
"mypy>=2.1.0",
"pytest>=9.0.3",
"pytest-cov>=7.1.0",
"ruff>=0.16.0",
"types-pyserial>=3.5.0",
"vulture>=2.16",
]
[tool.ruff.lint]
# Informed by the official Ruff configurations used by FastAPI, Pydantic,
# Pydantic AI, and HTTPX, then tailored for strict typed projects:
# https://github.com/fastapi/fastapi/blob/master/pyproject.toml
# https://github.com/pydantic/pydantic/blob/main/pyproject.toml
# https://github.com/pydantic/pydantic-ai/blob/main/pyproject.toml
# https://github.com/encode/httpx/blob/master/pyproject.toml
extend-select = [
# Baseline correctness, validation, and security.
"E", # Pycodestyle errors
"W", # Pycodestyle warnings
"F", # Pyflakes correctness
"B", # Flake8 Bugbear correctness checks
"A004", # Prevent imports from shadowing built-ins
"A005", # Prevent modules from shadowing the standard library
"ARG", # Reject unused callable arguments
"PLE", # Pylint error-level correctness checks
"PLW", # Pylint warning-level correctness checks
"S", # Bandit-derived security checks
"RUF064", # Require octal literals for file-permission modes
# Runtime, asynchronous, framework, and control-flow correctness.
"ASYNC", # Detect blocking and unsafe async patterns
"RUF006", # Retain references to created asyncio tasks
"FAST", # FastAPI-specific correctness checks
"RUF021", # Parenthesize mixed and/or expressions
"RUF060", # Reject membership tests against empty collections
"SIM105", # Use contextlib.suppress for intentional suppression
"TRY300", # Keep success-only statements outside try blocks
# Imports, modernization, performance, and maintainability.
"I", # Import ordering
"UP", # Modernize syntax for the Python target
"FURB", # Stable Refurb modernization checks
"C4", # Improve comprehensions
"RUF005", # Prefer unpacking over collection concatenation
"PERF", # Performance anti-patterns
"N", # PEP 8 naming conventions
"D", # Docstring conventions
"C90", # McCabe complexity
"PLR0913", # Excessive function arguments
# Logging, tests, and development hygiene.
"LOG", # Logging API correctness
"G", # Logging format-string correctness
"T20", # Print statements
"PT", # Pytest correctness and style checks
"RUF043", # Require unambiguous pytest.raises() patterns
"PGH", # Detect blanket suppressions and invalid mock access
"RUF10", # Validate noqa and suppression directives
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
# Pytest assertions are test checks, not runtime security guards.
"tests/**/*.py" = ["S101"]
# Vulture whitelist files intentionally use undefined bare-name expressions
# to mark dynamically consumed symbols as used.
"vulture_whitelist.py" = ["B018", "F821"]
[tool.mypy]
strict = true
disallow_any_decorated = true
disallow_any_explicit = true
disallow_any_unimported = true
warn_unreachable = true
enable_error_code = [
"deprecated",
"exhaustive-match",
"ignore-without-code",
"possibly-undefined",
"truthy-bool",
"truthy-iterable",
"unimported-reveal",
"unused-awaitable",
]
files = ["src", "tests"]
[tool.vulture]
min_confidence = 60
paths = ["src", "tests", "vulture_whitelist.py"]
sort_by_size = true
[tool.pytest.ini_options]
addopts = "-v --maxfail=1 --cov=xkc_kl200_python --cov-fail-under=100"