-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
387 lines (341 loc) · 10.8 KB
/
pyproject.toml
File metadata and controls
387 lines (341 loc) · 10.8 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
[project]
name = "asyncplatform"
description = "Itential Platform Async Client for Python"
license = {text = "GPL-3.0-or-later"}
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"ipsdk"
]
dynamic = [
"version"
]
keywords = [
"itential",
"automation",
"platform",
"rest",
"api",
]
classifiers = [
"Intended Audience :: Developers",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Typing :: Typed",
]
[[project.authors]]
name = "Itential"
email = "opensource@itential.com"
[project.urls]
Homepage = "https://itential.com"
Repository = "https://github.com/itential/asyncplatform"
Documentation = "https://github.com/itential/asyncplatform"
[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"q",
"ruff",
"mypy",
"coverage",
"build",
"bandit[toml]",
"pre-commit",
"tox",
"tox-uv",
]
[build-system]
requires = ["hatchling", "uv-dynamic-versioning>=0.7.0"]
build-backend = "hatchling.build"
[tool.setuptools.dynamic]
version = { attr = "asyncplatform.metadata.version" }
[tool.hatch.version]
source = "uv-dynamic-versioning"
[tool.uv-dynamic-versioning]
vcs = "git"
style = "pep440"
bump = true
fallback-version = "0.0.0"
[tool.ruff]
# Same as Black.
line-length = 88
indent-width = 4
# Assume Python 3.10+
target-version = "py310"
# Exclude common directories
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
[tool.ruff.lint]
# Enable comprehensive rule sets
select = [
# pycodestyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
# Pyflakes
"F", # Pyflakes
# pyupgrade
"UP", # pyupgrade
# flake8-bugbear
"B", # flake8-bugbear
# flake8-simplify
"SIM", # flake8-simplify
# isort
"I", # isort
# flake8-comprehensions
"C4", # flake8-comprehensions
# flake8-pie
"PIE", # flake8-pie
# flake8-unused-arguments
"ARG", # flake8-unused-arguments
# flake8-use-pathlib
"PTH", # flake8-use-pathlib
# flake8-quotes
"Q", # flake8-quotes
# flake8-return
"RET", # flake8-return
# flake8-raise
"RSE", # flake8-raise
# flake8-self
"SLF", # flake8-self
# flake8-type-checking
"TCH", # flake8-type-checking
# pylint
"PL", # pylint
# pygrep-hooks
"PGH", # pygrep-hooks
# Ruff-specific rules
"RUF", # Ruff-specific rules
# flake8-logging-format
"G", # flake8-logging-format
# flake8-annotations
"ANN", # flake8-annotations
# flake8-async
"ASYNC", # flake8-async
# flake8-bandit
"S", # flake8-bandit (security)
# flake8-boolean-trap
"FBT", # flake8-boolean-trap
# flake8-datetime
"DTZ", # flake8-datetime
# flake8-errmsg
"EM", # flake8-errmsg
# flake8-executable
"EXE", # flake8-executable
# flake8-implicit-str-concat
"ISC", # flake8-implicit-str-concat
# flake8-import-conventions
"ICN", # flake8-import-conventions
# flake8-logging
"LOG", # flake8-logging
# flake8-no-pep420
"INP", # flake8-no-pep420
# flake8-print
"T20", # flake8-print
# flake8-pytest-style
"PT", # flake8-pytest-style
# flake8-slots
"SLOT", # flake8-slots
# flake8-tidy-imports
"TID", # flake8-tidy-imports
# tryceratops
"TRY", # tryceratops
# perflint
"PERF", # perflint
# refurb
"FURB", # refurb
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords (S105, S106 - hardcoded strings, S107 - default params)
"S105", "S106", "S107",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
# Allow print statements (useful for debugging)
"T201",
# Allow assert statements (used for internal validation in SDK)
"S101",
# Allow subprocess without shell=False (we control the input)
"S603",
# Allow start-process-with-partial-path
"S607",
# Allow use of `typing.Any`
"ANN401",
# Allow missing docstrings for magic methods
"D105",
# Allow missing docstrings in __init__
"D107",
# Allow relative imports for local packages
"TID252",
# Allow catching broad exceptions (necessary for HTTP client)
"BLE001",
# Allow raise without from inside except
"B904",
# Allow too many return statements
"PLR0911",
# Allow too many arguments
"PLR0913",
# Allow implicit string concatenation (useful for long strings)
"ISC001",
# Allow passing strings directly to exceptions
"EM101", "EM102", "EM103",
# Allow long exception messages outside exception class
"TRY003",
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = [
"PLR2004", # Magic value used in comparison
"S101", # Use of assert detected
"S110", # try-except-pass (acceptable in tests)
"TID252", # Relative imports from parent modules are banned
"ANN", # Missing type annotations
"ARG", # Unused function arguments
"FBT", # Boolean trap
"PT011", # pytest.raises too broad
"SLF001", # Private member accessed (tests need to access private methods)
"TRY301", # Abstract raise to inner function (acceptable in test patterns)
"PT017", # Assert on exception in except block (acceptable test pattern)
"PERF203", # try-except within loop (acceptable in tests)
"PERF401", # Use list.extend (acceptable in tests)
"E501", # Line too long (docstrings and assertions can be longer)
"PLC0415", # Import should be at top of file (acceptable in tests)
"PTH", # Use pathlib (os.path acceptable in tests)
"SIM117", # Nested with statements (clearer in tests)
]
# Public API functions can use boolean parameters
"src/asyncplatform/client.py" = [
"FBT001", # Boolean-typed positional argument (part of public API)
"FBT002", # Boolean default positional argument (part of public API)
"TRY301", # Abstract raise to inner function (acceptable for error handling)
]
"src/asyncplatform/cache.py" = [
"SIM105", # try-except-pass (intentional for async cleanup)
]
"src/asyncplatform/context.py" = [
"FBT001", # Boolean-typed positional argument (part of public API)
"FBT002", # Boolean default positional argument (part of public API)
"S110", # try-except-pass (intentional for cleanup)
"SIM105", # try-except-pass (intentional for cleanup)
]
"src/asyncplatform/exceptions.py" = [
"S110", # try-except-pass (intentional for error handling)
]
"src/asyncplatform/logging.py" = [
"FBT001", # Boolean-typed positional argument (part of public API)
"FBT002", # Boolean default positional argument (part of public API)
"G004", # Logging statement uses f-string (acceptable for informational logging)
"E501", # Line too long (docstrings can be longer)
"PLW0603", # Global statement (used for module-level state)
]
"src/asyncplatform/heuristics.py" = [
"ARG004", # Unused static method argument (part of API signature)
"ARG005", # Unused lambda argument (pattern matching)
"B023", # Function binding loop variable (intentional for closures)
"E501", # Line too long (regex patterns can be longer)
]
"src/asyncplatform/services/adapters.py" = [
"FBT001", # Boolean-typed positional argument (part of public API)
"FBT002", # Boolean default positional argument (part of public API)
"E501", # Line too long (docstrings can be longer)
]
"src/asyncplatform/services/automation_studio.py" = [
"PLC0415", # Import inside function (lazy loading for optional dependency)
"E702", # Multiple statements on one line (compact import check)
]
"src/asyncplatform/services/configuration_manager.py" = [
"SLF001", # Private member accessed (accessing base class private method)
"E501", # Line too long (docstrings can be longer)
]
"src/asyncplatform/services/__init__.py" = [
"E501", # Line too long (docstrings can be longer)
"TRY300", # Consider else block (acceptable pattern for exception handling)
]
"src/asyncplatform/services/*.py" = [
"E501", # Line too long (docstrings can be longer)
]
[tool.ruff.lint.isort]
known-first-party = ["asyncplatform"]
force-single-line = true
lines-between-types = 1
[tool.ruff.lint.pylint]
max-args = 8
max-branches = 15
max-returns = 8
max-statements = 60
[tool.ruff.lint.flake8-type-checking]
strict = false
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.bandit]
exclude_dirs = ["tests", "build", "dist"]
# Security exceptions for SDK development:
# B101: assert_used - Asserts used for internal validation and type checking
# B107: hardcoded_password_default - Default values are examples for documentation only
# B110: try_except_pass - Intentional pass in exception handling for graceful degradation
skips = ["B101", "B107", "B110"]
# Additional bandit configuration
[tool.bandit.assert_used]
skips = ["*_test.py", "test_*.py"]
[tool.mypy]
# Mypy configuration for type checking tests
python_version = "3.10"
# Ignore missing imports for packages without type stubs
ignore_missing_imports = true
# Show error codes
show_error_codes = true
# Strict checking
strict = false
# Don't error on untyped calls in tests
disallow_untyped_calls = false
# Don't error on untyped defs in tests
disallow_untyped_defs = false
# Per-module options for modules with dynamic attributes
[[tool.mypy.overrides]]
module = "asyncplatform.logging"
# Ignore attribute errors for custom logging levels (TRACE, NONE)
disable_error_code = ["attr-defined", "arg-type"]
[[tool.mypy.overrides]]
module = "asyncplatform.resources.*"
# Ignore attribute errors for dynamically loaded service attributes
disable_error_code = ["attr-defined"]