pyproject.toml 3.7 KB

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