-
Notifications
You must be signed in to change notification settings - Fork 239
/
pyproject.toml
291 lines (261 loc) · 10.6 KB
/
pyproject.toml
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
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins."nornir.plugins.runners"]
"serial" = "nornir.plugins.runners:SerialRunner"
"threaded" = "nornir.plugins.runners:ThreadedRunner"
[tool.poetry.plugins."nornir.plugins.inventory"]
"SimpleInventory" = "nornir.plugins.inventory.simple:SimpleInventory"
[tool.poetry]
name = "nornir"
version = "3.4.1"
description = "Pluggable multi-threaded framework with inventory management to help operate collections of devices"
authors = ["David Barroso <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/nornir-automation/nornir"
classifiers = [
"License :: OSI Approved :: Apache Software License 2.0 (Apache-2.0)",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
"ruamel.yaml" = ">=0.17"
# importlib.metadata has an API change in 3.10 and is no longer provisional
importlib-metadata = { version = "^4", python = "<3.10" }
setuptools = ">=42.0.0"
[tool.poetry.group.dev.dependencies]
decorator = "*"
nbval = "^0.10.0"
pytest = "*"
pytest-cov = "*"
requests-mock = "*"
mypy = "^1.5.1"
types-Jinja2 = "^2.11.9"
types-setuptools= ">=75.5.0.20241116"
nornir-jinja2 = "0.2.0"
nornir-utils = "0.2.0"
# needed until underlying issue with PyEZ and PY3.13 (telnetlib) is fixed. Dev/testing fix only
junos-eznc = { git = "https://github.com/ktbyers/py-junos-eznc.git", rev = "468b0019ebad8361958604efafa83f009ef75683" }
napalm = { git = "https://github.com/napalm-automation/napalm", rev = "e2f8e7e24f9cff5fc4ce5d67ab0a4d5e9fce097b" }
nornir-napalm = "0.5.0"
# ncclient 0.6.16 broke Windows support; should be fixed in next release of ncclient
ncclient = "0.6.15"
ruff = "^0.4.9"
[tool.poetry.group.docs.dependencies]
sphinx = "6.2.1"
sphinx_rtd_theme = "1.2.2"
sphinxcontrib-napoleon = "^0.7"
jupyter = "1.0.0"
nbsphinx = "0.9.2"
pygments = "2.16.1"
sphinx-issues = "3.0.1"
[tool.mypy]
# The mypy configurations: http://bit.ly/2zEl9WI
python_version = "3.8"
check_untyped_defs = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
ignore_errors = false
ignore_missing_imports = true
strict_optional = true
warn_unused_configs = true
warn_unused_ignores = true
warn_return_any = true
warn_redundant_casts = true
[[tool.mypy.overrides]]
module = "tests.conftest"
disable_error_code = [
"return-value",
]
[[tool.mypy.overrides]]
module = "tests.core.test_InitNornir"
disable_error_code = [
"arg-type",
]
[[tool.mypy.overrides]]
module = "tests.core.test_filter"
disable_error_code = [
"arg-type",
"assignment",
"operator"
]
[[tool.mypy.overrides]]
module = "tests.core.test_inventory"
disable_error_code = [
"arg-type",
"index"
]
[[tool.mypy.overrides]]
module = "tests.wrapper"
disable_error_code = [
"import-untyped",
"misc",
"no-any-return"
]
[tool.ruff]
line-length = 100
[tool.ruff.lint]
preview = true
select = [
"A", # flake8-builtins
"AIR", # Airflow
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe complexity
"COM", # flake8-commas
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"ERA", # eradicate
"EXE", # flake8-executable
"F", # pyflakes
"FBT", # flake8-boolean-trap
"FIX", # flake8-fixme
"FLY", # flynt
"FURB", # refurb
"I", # isort-like checks
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"N", # pep8-naming
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"TCH", # flake8-type-checking
"TD", # flake8-todos
"TRIO", # flake8-trio
"T10", # flake8-debugger
"T20", # flake8-print
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]
ignore = [
"ISC001", # Recommended to be disabled when used with ruff formatter
"N801", # Class name should use CapWords convention
"N818", # Exception name should be named with an Error suffix
##################################################################################################
# The ignored rules below should be removed once the code has been updated, they are included #
# like this so that we can reactivate them one by one. Alternatively ignored after further #
# investigation if they are deemed to not make sense. #
##################################################################################################
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ARG002", # Unused method argument
"B028", # No explicit `stacklevel` keyword argument found
"COM812", # Trailing comma missing
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FURB101", # `open` and `read` should be replaced by `Path(filename).read_text()`
"INP001", # File is part of an implicit namespace package. Add an `__init__.py`.
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PIE800", # Unnecessary spread `**`
"PLC2801", # Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function
"PLR6201", # Use a `set` literal when testing for membership
"PLR6301", # Method `run` could be a function, class method, or static method
"PLW1514", # `open` in text mode without explicit `encoding` argument
"PLW1641", # Object does not implement `__hash__` method
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PTH123", # `open()` should be replaced by `Path.open()`
"RSE102", # Unnecessary parentheses on raised exception
"RUF001", # String contains ambiguous `–` (EN DASH). Did you mean `-` (HYPHEN-MINUS)?
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"S701", # By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities.
"SLF001", # Private member accessed
"SIM108", # Use ternary operator `config = Config.from_file(config_file, **kwargs) if config_file else Config.from_dict(**kwargs)` instead of `if`-`else`-block
"SIM110", # Use `return any(g.name == group or g.has_parent_group(group) for g in self.groups)` instead of `for` loop
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer `TypeError` exception for invalid type
"TRY400", # Use `logging.exception` instead of `logging.error`
"UP015", # Unnecessary open mode parameters
"UP032", # Use f-string instead of `format` call
"UP034", # Avoid extraneous parentheses
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.pylint]
max-args = 11
max-branches = 16
max-positional-args = 10
max-public-methods = 22
max-returns = 11
[tool.ruff.lint.per-file-ignores]
"docs/conf.py" = [
"A001", # Variable `copyright` is shadowing a Python builtin
"ERA001", # Commented out code, used to provide examples for Sphinx docs
]
"nornir/core/configuration.py" = [
"A002", # Argument `format` / `help` is shadowing a Python builtin
]
"nornir/core/task.py" = [
"BLE001", # Do not catch blind exception: `Exception`
]
"nornir/init_nornir.py" = [
"N802", # Function name `InitNornir` should be lowercase
]
"tests/**.py" = [
"BLE001", # Do not catch blind exception: `Exception`
"N802", # Function name should be lowercase
"S101", # Use of assert detected
"S105", # Possible hardcoded password assigned
##################################################################################################
# The ignored rules below should be removed once the code has been updated, they are included #
# like this so that we can reactivate them one by one. Alternatively ignored after further #
# investigation if they are deemed to not make sense. #
##################################################################################################
"ARG001", # Unused function argument
"B007", # Loop control variable `host` not used within loop body
"C414", # Unnecessary `list` call within `sorted()`
"DTZ005", # `datetime.datetime.now()` called without a `tz` argument
"LOG009", # Use of undocumented `logging.WARN` constant
"N999", # Invalid module name
"PLC1901", # Can be simplified as an empty string is falsey
"PLR0904", # Too many public methods
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PT003", # `scope='function'` is implied in `@pytest.fixture()`
"PT004", # Fixture does not return anything, add leading underscore
"PT006", # Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
"PT012", # `pytest.raises()` block should contain a single simple statement
"PT018", # Assertion should be broken down into multiple parts
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"SIM118", # Use `key in dict` instead of `key in dict.keys()`
]