[build-system]
requires = ["setuptools==80.9.0"]
build-backend = "setuptools.build_meta"

[project]
name = "tibber_prices"
version = "0.0.0"          # Version is managed in manifest.json only
requires-python = ">=3.13"

[tool.setuptools]
packages = ["custom_components.tibber_prices"]

[tool.pyright]
include = ["custom_components/tibber_prices"]
exclude = [
    "**/node_modules",
    "**/__pycache__",
    "**/.git",
    "**/.github",
    "**/docs",
    "**/venv",
    "**/.venv",
]
venvPath = "."
venv = ".venv"
typeCheckingMode = "basic"

[tool.ruff]
# Based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
target-version = "py313"
line-length = 120

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    #    "ANN101",  # Missing type annotation for `self` in method
    "ANN401", # Dynamically typed expressions (typing.Any) are disallowed
    "D203",   # no-blank-line-before-class (incompatible with formatter)
    "D212",   # multi-line-summary-first-line (incompatible with formatter)
    "COM812", # incompatible with formatter
    "ISC001", # incompatible with formatter
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
    "S101",    # assert is fine in tests
    "PLR2004", # Magic values are fine in tests
]

[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false

[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true

[tool.ruff.lint.mccabe]
max-complexity = 25

[tool.ruff.lint.isort]
force-single-line = false
known-first-party = ["custom_components", "homeassistant"]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_default_fixture_loop_scope = "function"
addopts = "-ra -q --strict-markers"
markers = [
    "unit: Unit tests (fast, no external dependencies)",
    "integration: Integration tests (may use coordinator/time service)",
]

[project.optional-dependencies]
test = [
    "pytest>=8.0.0",
    "pytest-asyncio>=0.23.0",
    "pytest-homeassistant-custom-component>=0.13.0",
]
