-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpyproject.toml
More file actions
138 lines (122 loc) · 4.54 KB
/
Copy pathpyproject.toml
File metadata and controls
138 lines (122 loc) · 4.54 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
[build-system]
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"
[project]
name = "pybirdbuddy"
version = "0.0.22"
description = "A library to query data about a Bird Buddy smart bird feeder"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT-0"
license-files = ["LICENSE"]
authors = [{ name = "jhansche", email = "madcoder@gmail.com" }]
dependencies = [
"python-graphql-client",
"langcodes",
]
[project.optional-dependencies]
dev = [
"pytest~=9.1",
"pytest-asyncio~=1.4",
"pytest-aiohttp~=1.1",
"pytest-cov~=7.1",
"coverage~=7.15",
"python-dotenv~=1.2",
"ruff>=0.15.20,<0.17.0",
"pyright~=1.1.411",
"build~=1.5",
"twine~=6.2",
]
[project.urls]
Homepage = "https://github.com/jhansche/pybirdbuddy"
[tool.setuptools.packages.find]
include = ["birdbuddy*"]
[tool.setuptools.package-data]
# Ship the PEP 561 marker so downstream type-checkers consume our annotations.
birdbuddy = ["py.typed"]
# https://docs.astral.sh/ruff/configuration/
[tool.ruff]
# 88 is the default line length for both ruff and Black.
# https://docs.astral.sh/ruff/settings/#line-length
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
line-length = 88
target-version = "py310"
include = ["birdbuddy/**/*.py", "tests/**/*.py", "scripts/**/*.py"]
# https://docs.astral.sh/ruff/rules/
[tool.ruff.lint]
select = [
"E", "W", # pycodestyle errors and warnings
"F", # Pyflakes (unused imports, undefined names)
"I", # isort (import sorting)
"ANN", # flake8-annotations (type hints required)
"ASYNC", # flake8-async (async/await best practices)
"B", # flake8-bugbear (likely bugs and design problems)
"BLE", # flake8-blind-except (no broad exception catching)
"C4", # flake8-comprehensions
"EM", # flake8-errmsg (exception message formatting)
"FA", # flake8-future-annotations (require __future__ annotations)
"G", # flake8-logging-format (no f-strings in logging)
"PIE", # flake8-pie (unnecessary code patterns)
"T20", # flake8-print (disallow print statements)
"PT", # flake8-pytest-style (pytest conventions)
"SIM", # flake8-simplify (simplification suggestions)
"ARG", # flake8-unused-arguments (unused function args)
"PTH", # flake8-use-pathlib (prefer pathlib over os.path)
"TID252", # flake8-tidy-imports (no relative imports)
"TRY", # tryceratops (exception handling best practices)
"N", # pep8-naming (naming conventions)
"PLC", # Pylint convention (includes import-outside-top-level)
"PLR0915", # Pylint too-many-statements
"S101", # flake8-bandit assert (banned in source; allowed in tests)
"S110", # flake8-bandit try-except-pass
"S112", # flake8-bandit try-except-continue
"UP", # pyupgrade
"D", # pydocstyle
]
ignore = [
"D203", # incompatible with D211 (no-blank-line-before-class)
"D213", # incompatible with D212 (multi-line-summary-first-line)
"TRY003", # long exception messages are fine
]
[tool.ruff.lint.pydocstyle]
# Google-style docstrings so multi-line docstrings carry Args:/Returns:/Raises:.
convention = "google"
[tool.ruff.lint.pylint]
max-statements = 40 # Google style guide recommends ~40 lines per function
[tool.ruff.lint.flake8-tidy-imports]
# Ban ALL relative imports (including single-dot); require absolute paths.
ban-relative-imports = "all"
[tool.ruff.lint.isort]
force-sort-within-sections = true
combine-as-imports = true
split-on-trailing-comma = false
[tool.ruff.lint.per-file-ignores]
# Relax the requirements for test files (one-line docstrings still required).
"tests/*" = [
"ANN001", # Missing type annotation for function argument
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG005", # Unused lambda argument
"S101", # asserts are expected in tests
]
# Dev/maintenance scripts may print progress and use dynamic Any helpers.
"scripts/*" = ["T201", "ANN401"]
# GraphQL query strings are long by nature; don't wrap the query text.
"birdbuddy/queries/*" = ["E501"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
addopts = [
"-q",
"--cov=birdbuddy",
"--cov-report=term",
"--cov-report=html",
"--junit-xml=junit.xml",
]
testpaths = ["tests"]
[tool.coverage.run]
source = ["birdbuddy"]
omit = ["tests/*"]
[tool.coverage.report]
show_missing = true