[build-system]
requires = ["setuptools==80.9.0", "wheel>=0.43,<0.46"]
build-backend = "setuptools.build_meta"

[project]
name        = "esphome"
license     = "MIT"
description = "ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems."
readme      = "README.md"
authors     = [
  {name = "The ESPHome Authors", email = "esphome@openhomefoundation.org"}
]
keywords    = ["home", "automation"]
classifiers = [
    "Environment :: Console",
    "Intended Audience :: Developers",
    "Intended Audience :: End Users/Desktop",
    "Programming Language :: C++",
    "Programming Language :: Python :: 3",
    "Topic :: Home Automation",
]

# Python 3.14 is currently not supported by IDF <= 5.5.1, see https://github.com/esphome/esphome/issues/11502
requires-python = ">=3.11.0,<3.14"

dynamic = ["dependencies", "optional-dependencies", "version"]

[project.urls]
"Documentation"           = "https://esphome.io"
"Source Code"             = "https://github.com/esphome/esphome"
"Bug Tracker"             = "https://github.com/esphome/esphome/issues"
"Feature Request Tracker" = "https://github.com/orgs/esphome/discussions"
"Discord"                 = "https://discord.gg/KhAMKrd"
"Forum"                   = "https://community.home-assistant.io/c/esphome"
"Twitter"                 = "https://twitter.com/esphome_"

[project.scripts]
esphome = "esphome.__main__:main"

[tool.setuptools]
platforms            = ["any"]
zip-safe             = false
include-package-data = true

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
version = {attr = "esphome.const.__version__"}

[tool.setuptools.dynamic.optional-dependencies]
dev = { file = ["requirements_dev.txt"] }
test = { file = ["requirements_test.txt"] }

[tool.setuptools.packages.find]
include = ["esphome*"]

[tool.pytest.ini_options]
testpaths = [
  "tests",
]
addopts = [
  "--cov=esphome",
  "--cov-branch",
]

[tool.pylint.MAIN]
py-version = "3.11"
ignore = [
  "api_pb2.py",
]
persistent = false

[tool.pylint.REPORTS]
score = false

[tool.pylint."MESSAGES CONTROL"]
disable = [
  "format",
  "missing-docstring",
  "fixme",
  "unused-argument",
  "global-statement",
  "too-few-public-methods",
  "too-many-lines",
  "too-many-locals",
  "too-many-ancestors",
  "too-many-branches",
  "too-many-statements",
  "too-many-arguments",
  "too-many-positional-arguments",
  "too-many-return-statements",
  "too-many-instance-attributes",
  "duplicate-code",
  "invalid-name",
  "cyclic-import",
  "redefined-builtin",
  "undefined-loop-variable",
  "useless-object-inheritance",
  "stop-iteration-return",
  "import-outside-toplevel",
  # Broken
  "unsupported-membership-test",
  "unsubscriptable-object",
]

[tool.pylint.FORMAT]
expected-line-ending-format = "LF"

[tool.ruff]
required-version = ">=0.5.0"
target-version = "py311"
exclude = ['generated']

[tool.ruff.lint]
select = [
  "E",    # pycodestyle
  "F",    # pyflakes/autoflake
  "FURB", # refurb
  "I",    # isort
  "PERF", # performance
  "PL",   # pylint
  "SIM",  # flake8-simplify
  "RET",  # flake8-ret
  "UP",   # pyupgrade
]

ignore = [
  "E501", # line too long
  "PLC0415", # `import` should be at the top-level of a file
  "PLR0911", # Too many return statements ({returns} > {max_returns})
  "PLR0912", # Too many branches ({branches} > {max_branches})
  "PLR0913", # Too many arguments to function call ({c_args} > {max_args})
  "PLR0915", # Too many statements ({statements} > {max_statements})
  "PLW1641", # Object does not implement `__hash__` method
  "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
  "PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
  "UP038", # https://github.com/astral-sh/ruff/issues/7871 https://github.com/astral-sh/ruff/pull/16681
]

[tool.ruff.lint.isort]
force-sort-within-sections = true
known-first-party = [
  "esphome",
]
combine-as-imports = true
split-on-trailing-comma = false
