pyproject.toml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # See PEP 518 for the spec of this file
  2. # https://www.python.org/dev/peps/pep-0518/
  3. [project]
  4. name = "netbox"
  5. version = "4.6.4"
  6. requires-python = ">=3.12"
  7. description = "The premier source of truth powering network automation."
  8. readme = "README.md"
  9. license = "Apache-2.0"
  10. license-files = ["LICENSE.txt"]
  11. classifiers = [
  12. "Development Status :: 5 - Production/Stable",
  13. "Framework :: Django",
  14. "Natural Language :: English",
  15. "Programming Language :: Python",
  16. "Programming Language :: Python :: 3 :: Only",
  17. "Programming Language :: Python :: 3.12",
  18. "Programming Language :: Python :: 3.13",
  19. "Programming Language :: Python :: 3.14",
  20. ]
  21. [project.urls]
  22. Homepage = "https://netboxlabs.com/products/netbox/"
  23. Documentation = "https://netboxlabs.com/docs/netbox/"
  24. Source = "https://github.com/netbox-community/netbox"
  25. Issues = "https://github.com/netbox-community/netbox/issues"
  26. [tool.coverage.run]
  27. source = ["netbox/"]
  28. concurrency = ["multiprocessing"]
  29. parallel = true
  30. sigterm = true
  31. [tool.coverage.report]
  32. skip_covered = true
  33. fail_under = 91
  34. omit = [
  35. "*/migrations/*",
  36. "*/tests/*",
  37. # Non-application code (no testable logic / not part of the app)
  38. "netbox/scripts/*", # SCRIPTS_ROOT: user/generated scripts
  39. "*/netbox/configuration*.py", # settings/config files (template, testing, local)
  40. "*/netbox/wsgi.py", # WSGI entrypoint
  41. "*/generate_secret_key.py", # standalone CLI helper
  42. "*/utilities/debug.py", # debug-toolbar hook, active only when DEBUG=True
  43. "*/extras/management/commands/housekeeping.py", # deprecated; will not be tested
  44. ]
  45. [tool.pyright]
  46. include = ["netbox"]
  47. exclude = [
  48. "**/node_modules",
  49. "**/__pycache__",
  50. ]
  51. reportMissingImports = true
  52. reportMissingTypeStubs = false
  53. [tool.ruff]
  54. exclude = [
  55. ".eggs",
  56. ".git",
  57. ".pyenv",
  58. ".pytest_cache",
  59. ".ruff_cache",
  60. ".venv",
  61. ".vscode",
  62. "__pypackages__",
  63. "_build",
  64. "build",
  65. "dist",
  66. "netbox/project-static/**",
  67. "node_modules",
  68. "site-packages",
  69. "venv",
  70. ]
  71. # Enforce line length and indent-width
  72. line-length = 120
  73. indent-width = 4
  74. # Ignores anything in .gitignore
  75. respect-gitignore = true
  76. # Always generate Python 3.12-compatible code
  77. target-version = "py312"
  78. [tool.ruff.lint]
  79. # Pin the effective default rule set used with `preview = true` to match Ruff 0.15.1.
  80. # Ruff 0.15.2 changed the preview defaults, see https://github.com/astral-sh/ruff/releases/tag/0.15.2
  81. # Keeping this explicit makes ruff deterministic.
  82. select = ["E4", "E7", "E9", "F"]
  83. extend-select = [
  84. "E1", # pycodestyle errors: indentation-related (e.g., unexpected/missing indent)
  85. "E2", # pycodestyle errors: whitespace-related (e.g., missing whitespace, extra spaces)
  86. "E3", # pycodestyle errors: blank lines / spacing around definitions
  87. "E501", # pycodestyle: line too long (enforced with `line-length` above)
  88. "W", # pycodestyle warnings (various style warnings, often whitespace/newlines)
  89. "I", # import sorting (isort-equivalent)
  90. "RET", # return semantics (flake8-return family: consistent/explicit returns; remove redundant else/assign before return)
  91. "UP", # pyupgrade: modernize syntax for your target Python (e.g., f-strings, built-in generics, newer stdlib idioms)
  92. "RUF022", # ruff: enforce sorted `__all__` lists
  93. ]
  94. # If you add a rule to `ignore`, please also update the "Linter Exceptions" section in
  95. # docs/development/style-guide.md.
  96. ignore = [
  97. "F403", # pyflakes: `from ... import *` used; unable to detect undefined names
  98. "F405", # pyflakes: name may be undefined or defined from star imports
  99. "RET504", # return: unnecessary assignment before `return` (e.g., `x = expr; return x` -> `return expr`)
  100. "UP032", # pyupgrade: prefer f-strings over `str.format(...)`
  101. ]
  102. preview = true
  103. [tool.ruff.lint.isort]
  104. known-first-party = [
  105. "account",
  106. "circuits",
  107. "core",
  108. "dcim",
  109. "extras",
  110. "ipam",
  111. "netbox",
  112. "tenancy",
  113. "users",
  114. "utilities",
  115. "virtualization",
  116. "vpn",
  117. "wireless",
  118. ]
  119. [tool.ruff.lint.per-file-ignores]
  120. "template_code.py" = ["E501"]
  121. "netbox/netbox/graphql/filter_lookups.py" = ["UP046"] # Strawberry typing: keep `Generic[T]` for now
  122. "netbox/netbox/graphql/scalars.py" = ["UP007"] # Strawberry scalar typing: `Union[...]` required
  123. [tool.ruff.format]
  124. # Use single quotes for strings.
  125. quote-style = "single"
  126. # Indent with spaces, rather than tabs.
  127. indent-style = "space"
  128. # Enforce UNIX line ending
  129. line-ending = "lf"