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 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
|
# content of pyproject.toml
[build-system]
requires = ["setuptools>=77.0.0"]
build-backend = "setuptools.build_meta"
[project]
name = "anta"
version = "v1.7.0"
readme = "docs/README.md"
authors = [{ name = "Arista Networks ANTA maintainers", email = "anta-dev@arista.com" }]
maintainers = [
{ name = "Arista Networks ANTA maintainers", email = "anta-dev@arista.com" },
{ name = "Khelil Sator", email = "ksator@arista.com" },
{ name = "Matthieu Tâche", email = "mtache@arista.com" },
{ name = "Thomas Grimonet", email = "tgrimonet@arista.com" },
{ name = "Guillaume Mulocher", email = "gmulocher@arista.com" },
{ name = "Carl Baillargeon", email = "carl.baillargeon@arista.com" },
]
description = "Arista Network Test Automation (ANTA) Framework"
dependencies = [
"asyncssh>=2.16",
"cvprac>=1.3.1",
"httpx>=0.27.0",
"Jinja2>=3.1.2",
"pydantic>=2.7",
"pydantic-extra-types>=2.3.0",
"pydantic-settings>=2.6.0",
"PyYAML>=6.0",
"requests>=2.31.0",
"rich>=13.5.2,<15",
"typing_extensions>=4.12" # required for deprecated before Python 3.13
]
keywords = ["test", "anta", "Arista", "network", "automation", "networking", "devops", "netdevops"]
license = "Apache-2.0"
license-files = ["LICENSE"]
classifiers = [
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Information Technology",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
"Topic :: System :: Networking",
]
requires-python = ">=3.10"
[project.optional-dependencies]
cli = [
"click~=8.3",
]
[dependency-groups]
dev = [
{include-group = "test"},
{include-group = "lint"},
"bumpver>=2023.1129",
]
test = [
"pytest-asyncio>=1.0.0",
"pytest-cov>=4.1.0",
"pytest-dependency",
"pytest-codspeed>=2.2.0,!=4.1.0",
"pytest-html>=3.2.0",
"pytest-httpx>=0.30.0",
"pytest-metadata>=3.0.0",
"pytest>=7.4.0",
"respx>=0.22.0",
"tox>=4.10.0,<5.0.0",
]
lint = [
"codespell>=2.2.6,<2.5.0",
"pre-commit>=3.3.3",
"pylint-pydantic>=0.2.4",
"pylint>=2.17.5",
"pyright",
"ruff>=0.5.4,<0.15.0",
"types-PyYAML",
"types-pyOpenSSL",
"types-requests",
"typing-extensions",
"yamllint>=1.32.0",
]
doc = [
"black>=24.10.0",
"fontawesome_markdown>=0.2.6",
"griffe ~=1.15.0",
"griffe-warnings-deprecated~=1.1.0",
"mike==2.1.3",
"mkdocs~=1.6",
"mkdocs-autorefs~=1.4",
"mkdocs-bootswatch~=1.1",
"mkdocs-git-revision-date-localized-plugin~=1.5",
"mkdocs-git-revision-date-plugin~=0.3.2",
"mkdocs-github-admonitions-plugin~=0.1.1",
"mkdocs-glightbox~=0.5",
"mkdocs-material~=9.7",
"mkdocs-material-extensions>=1.3.1",
"mkdocstrings[python]~=1.0.0",
"mkdocstrings-python~=2.0.0",
]
[project.urls]
Homepage = "https://anta.arista.com"
"Bug Tracker" = "https://github.com/aristanetworks/anta/issues"
Contributing = "https://anta.arista.com/main/contribution/"
[project.scripts]
anta = "anta.cli:cli"
[tool.setuptools.packages.find]
include = ["anta*", "asynceapi*"]
namespaces = false
[tool.setuptools.package-data]
"anta" = ["py.typed"]
################################
# Version
################################
[tool.bumpver]
current_version = "1.7.0"
version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
commit_message = "bump: Version {old_version} -> {new_version}"
commit = true
# No tag
tag = false
push = false
[tool.bumpver.file_patterns]
"pyproject.toml" = ['current_version = "{version}"', 'version = "v{version}"']
"docs/contribution.md" = ["anta {version}"]
"docs/requirements-and-installation.md " = ["anta, version v{version}"]
################################
# Typing
################################
[tool.pyright]
typeCheckingMode = "standard"
exclude = [
# Excluded
".tox",
]
pythonVersion = "3.10"
reportMissingImports = "error"
################################
# Testing
################################
[tool.pytest.ini_options]
# When run from anta directory this will read cov-config from pyproject.toml
addopts = "-ra -q -vv --cov --cov-report term:skip-covered --color yes"
log_level = "WARNING"
render_collapsed = true
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
norecursedirs = ["tests/benchmark", ".*"] # Do not run performance testing outside of Codspeed
filterwarnings = [
# cvprac is raising the next warning
"default:pkg_resources is deprecated:DeprecationWarning",
# Need to investigate the following - only occurring when running the full pytest suite
"ignore:Exception ignored in.*:pytest.PytestUnraisableExceptionWarning",
# Ignore cryptography >=43.0.0 warnings until asyncssh issue is fixed
"ignore:ARC4:cryptography.utils.CryptographyDeprecationWarning",
"ignore:TripleDES:cryptography.utils.CryptographyDeprecationWarning",
]
[tool.coverage.run]
branch = true
# https://community.sonarsource.com/t/python-coverage-analysis-warning/62629/7
include = ["anta/*", "asynceapi/*"]
parallel = true
relative_files = true
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
# Don't complain about TYPE_CHECKING blocks
"if TYPE_CHECKING:",
# Don't complain about sys.version block
# Assume the tests of various Python version is handling this
"if sys.version_info >= (.*):",
# Don't complain about expected ImportError
"except ImportError:",
]
ignore_errors = true
[tool.coverage.html]
directory = "coverage_html_report"
[tool.coverage.xml]
output = ".coverage.xml"
################################
# Ruff
################################
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
".github",
]
line-length = 165
# Assume Python 3.10 as this is the lowest supported version for ANTA
target-version = "py310"
[tool.ruff.lint]
# select all cause we like being suffering
select = ["ALL",
# By enabling a convention for docstrings, ruff automatically ignore some rules that need to be
# added back if we want them.
# https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings
"D212",
"D415",
"D417",
]
ignore = [
"COM812", # Ignoring conflicting rules that may cause conflicts when used with the formatter
"ISC001", # Ignoring conflicting rules that may cause conflicts when used with the formatter
"TD002", # We don't have require authors in TODO
"TD003", # We don't have an issue link for all TODOs today
"FIX002", # Line contains TODO - ignoring for ruff for now
"F821", # Disable undefined-name until resolution of #10451
]
# Allow autofix 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.pydocstyle]
convention = "numpy"
[tool.ruff.lint.pylint]
# These settings are used to configure pylint rules run in ruff. In order to keep sane and while
# we have not removed pylint completely, these settings should be kept in sync with our pylintrc file.
# https://github.com/astral-sh/ruff/issues/970
max-branches = 13
max-args = 10
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.lint.pep8-naming]
"ignore-names" = [
"RICH_COLOR_PALETTE"
]
[tool.ruff.lint.flake8-type-checking]
# These classes require that type annotations be available at runtime
runtime-evaluated-base-classes = ["pydantic.BaseModel", "anta.models.AntaTest.Input"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # Complains about asserts in units and libs.
"SLF001", # Lots of private member accessed for test purposes
]
"tests/units/*" = [
"ARG002", # Sometimes we need to declare unused arguments when a parameter is not used but declared in @pytest.mark.parametrize
"FBT001", # Boolean-typed positional argument in function definition
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"S105", # Passwords are indeed hardcoded in tests
"S106", # Passwords are indeed hardcoded in tests
"S108", # Probable insecure usage of temporary file or directory
"PLC0415", # We do import modules in random places where needed for testing purposes
]
"tests/units/anta_tests/test_interfaces.py" = [
"S104", # False positive for 0.0.0.0 bindings in test inputs
]
"tests/units/anta_tests/*" = [
"F401", # In this module, we import tests.units.anta_tests.test without using it to auto-generate tests
]
"anta/*" = [
"TRY400", # Use `logging.exception` instead of `logging.error` - we know what we are doing
]
"anta/cli/exec/utils.py" = [
"SLF001", # TODO: some private members, lets try to fix
]
"anta/cli/__init__.py" = [
"T201", # Allow print statements
]
"anta/cli/*" = [
"PLR0913", # CLI has many arguments defined in functions
]
"anta/tests/field_notices.py" = [
"PLR2004", # Magic value used in comparison, consider replacing 2131 with a constant variable - Field notice IDs are magic values
"C901", # TODO: test function is too complex, needs a refactor
"PLR0911", # TODO: Too many return statements, same as above needs a refactor
]
"anta/tests/routing/isis.py" = [
"C901", # TODO: test function is too complex, needs a refactor
"PLR0912" # Too many branches (15/12) (too-many-branches), needs a refactor
]
"anta/tests/logging.py" = [
"A005", # TODO: Module `logging` shadows a Python standard-library module
]
"anta/input_models/logging.py" = [
"A005", # TODO: Module `logging` shadows a Python standard-library module
]
"anta/decorators.py" = [
"ANN401", # Ok to use Any type hint in our decorators
]
"anta/tools.py" = [
"ANN401", # Ok to use Any type hint in our custom get functions
]
"examples/*.py" = [ # These are example scripts and linked in snippets
"S105", # Possible hardcoded password
"S106", # Possible hardcoded password assigned to argument
"S108", # Probable insecure usage of temporary file or directory
"INP001", # Implicit packages
"T201", # `print` found
"T203", # `pprint` found
]
################################
# Pylint
################################
[tool.pylint]
disable = [ # Any rule listed here can be disabled: https://github.com/astral-sh/ruff/issues/970
"invalid-name",
"fixme",
"unused-import",
"unused-argument",
"keyword-arg-before-vararg",
"protected-access",
"too-many-arguments",
"too-many-positional-arguments",
"wrong-import-position",
"pointless-statement",
"broad-exception-caught",
"line-too-long",
"unused-variable",
"redefined-builtin",
"global-statement",
"reimported",
"wrong-import-order",
"wrong-import-position",
"unnecessary-lambda",
"abstract-class-instantiated", # Overlap with https://mypy.readthedocs.io/en/stable/error_code_list.html#check-instantiation-of-abstract-classes-abstract
"unexpected-keyword-arg", # Overlap with https://mypy.readthedocs.io/en/stable/error_code_list.html#check-arguments-in-calls-call-arg and other rules
"no-value-for-parameter", # Overlap with https://mypy.readthedocs.io/en/stable/error_code_list.html#check-arguments-in-calls-call-arg
"import-outside-toplevel"
]
max-statements=61
max-returns=8
max-locals=23
max-line-length=165
max-module-lines=1700
# making similarity lines limit a bit higher than default 4
min-similarity-lines=10
# https://stackoverflow.com/questions/49680191/click-and-pylint
signature-mutators="click.decorators.option"
load-plugins="pylint_pydantic"
extension-pkg-whitelist="pydantic"
# Pylint does not treat dataclasses differently: https://github.com/pylint-dev/pylint/issues/9058
max-attributes=15
|