pyproject.toml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.0"
  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. omit = [
  34. "*/migrations/*",
  35. "*/tests/*",
  36. ]
  37. [tool.pyright]
  38. include = ["netbox"]
  39. exclude = [
  40. "**/node_modules",
  41. "**/__pycache__",
  42. ]
  43. reportMissingImports = true
  44. reportMissingTypeStubs = false
  45. [tool.ruff]
  46. exclude = [
  47. ".eggs",
  48. ".git",
  49. ".pyenv",
  50. ".pytest_cache",
  51. ".ruff_cache",
  52. ".venv",
  53. ".vscode",
  54. "__pypackages__",
  55. "_build",
  56. "build",
  57. "dist",
  58. "netbox/project-static/**",
  59. "node_modules",
  60. "site-packages",
  61. "venv",
  62. ]
  63. # Enforce line length and indent-width
  64. line-length = 120
  65. indent-width = 4
  66. # Ignores anything in .gitignore
  67. respect-gitignore = true
  68. # Always generate Python 3.12-compatible code
  69. target-version = "py312"
  70. [tool.ruff.lint]
  71. # Pin the effective default rule set used with `preview = true` to match Ruff 0.15.1.
  72. # Ruff 0.15.2 changed the preview defaults, see https://github.com/astral-sh/ruff/releases/tag/0.15.2
  73. # Keeping this explicit makes ruff deterministic.
  74. select = ["E4", "E7", "E9", "F"]
  75. extend-select = [
  76. "E1", # pycodestyle errors: indentation-related (e.g., unexpected/missing indent)
  77. "E2", # pycodestyle errors: whitespace-related (e.g., missing whitespace, extra spaces)
  78. "E3", # pycodestyle errors: blank lines / spacing around definitions
  79. "E501", # pycodestyle: line too long (enforced with `line-length` above)
  80. "W", # pycodestyle warnings (various style warnings, often whitespace/newlines)
  81. "I", # import sorting (isort-equivalent)
  82. "RET", # return semantics (flake8-return family: consistent/explicit returns; remove redundant else/assign before return)
  83. "UP", # pyupgrade: modernize syntax for your target Python (e.g., f-strings, built-in generics, newer stdlib idioms)
  84. "RUF022", # ruff: enforce sorted `__all__` lists
  85. ]
  86. # If you add a rule to `ignore`, please also update the "Linter Exceptions" section in
  87. # docs/development/style-guide.md.
  88. ignore = [
  89. "F403", # pyflakes: `from ... import *` used; unable to detect undefined names
  90. "F405", # pyflakes: name may be undefined or defined from star imports
  91. "RET504", # return: unnecessary assignment before `return` (e.g., `x = expr; return x` -> `return expr`)
  92. "UP032", # pyupgrade: prefer f-strings over `str.format(...)`
  93. ]
  94. preview = true
  95. [tool.ruff.lint.isort]
  96. known-first-party = [
  97. "account",
  98. "circuits",
  99. "core",
  100. "dcim",
  101. "extras",
  102. "ipam",
  103. "netbox",
  104. "tenancy",
  105. "users",
  106. "utilities",
  107. "virtualization",
  108. "vpn",
  109. "wireless",
  110. ]
  111. [tool.ruff.lint.per-file-ignores]
  112. "template_code.py" = ["E501"]
  113. "netbox/netbox/graphql/filter_lookups.py" = ["UP046"] # Strawberry typing: keep `Generic[T]` for now
  114. "netbox/netbox/graphql/scalars.py" = ["UP007"] # Strawberry scalar typing: `Union[...]` required
  115. [tool.ruff.format]
  116. # Use single quotes for strings.
  117. quote-style = "single"
  118. # Indent with spaces, rather than tabs.
  119. indent-style = "space"
  120. # Enforce UNIX line ending
  121. line-ending = "lf"