[build-system]
requires = ["setuptools>=77.0", "wheel", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "aioiregul"
dynamic = ["version"]
description = "Asynchronous library to interact with Iregul systems via undocumented API"
readme = "README.md"
requires-python = ">=3.10"
license = "GPL-3.0-or-later"
authors = [
    {name = "PoppyPop", email = "skytep@gmail.com"}
]
keywords = ["iregul", "async", "api", "home-automation"]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Framework :: AsyncIO",
    "Topic :: Home Automation",
]

dependencies = [
    "aiohttp>=3.9.0",
    "beautifulsoup4>=4.12.0",
    "python-dotenv>=1.0.0",
    "python-slugify>=8.0.0",
]

[project.urls]
Homepage = "https://github.com/PoppyPop/aioiregul"
Repository = "https://github.com/PoppyPop/aioiregul"
Issues = "https://github.com/PoppyPop/aioiregul/issues"
"Bug Tracker" = "https://github.com/PoppyPop/aioiregul/issues"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.setuptools_scm]

[tool.setuptools.packages.find]
where = ["src"]
include = ["aioiregul*"]
namespaces = false

[tool.setuptools.package-data]
# Ship generated `.pyi` stubs and the PEP 561 marker
"aioiregul" = ["**/*.pyi", "py.typed"]

# Ruff configuration
[tool.ruff]
line-length = 100
src = ["src", "tests"]

[tool.ruff.lint]
select = [
    "E",   # pycodestyle errors
    "W",   # pycodestyle warnings
    "F",   # pyflakes
    "I",   # isort
    "B",   # flake8-bugbear
    "C4",  # flake8-comprehensions
    "UP",  # pyupgrade
    "ARG", # flake8-unused-arguments
    "SIM", # flake8-simplify
]
ignore = [
    "E501",  # line too long (handled by formatter)
    "B008",  # do not perform function calls in argument defaults
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]  # imported but unused
"tests/**/*.py" = ["ARG", "S101"]  # pytest uses assert
"**/*.pyi" = ["F821"]  # allow unresolved names in stubs

[tool.ruff.lint.isort]
known-first-party = ["aioiregul"]

[tool.pyright]
include = ["src"]
exclude = ["**/__pycache__", ".git", ".venv", "htmlcov", "tests", "examples", "**/*.pyi"]
pythonVersion = "3.14"
venvPath = "."
venv = ".venv"
typeCheckingMode = "strict"
reportMissingTypeStubs = "warning"

# Pytest configuration
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
addopts = [
    "--strict-markers",
    "--strict-config",
    "--cov=src/aioiregul",
    "--cov-report=term-missing",
    "--cov-report=html",
]

# Coverage configuration
[tool.coverage.run]
source = ["src/aioiregul"]
branch = true
omit = [
    "*/tests/*",
]

[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "raise AssertionError",
    "raise NotImplementedError",
    "if __name__ == .__main__.:",
    "if TYPE_CHECKING:",
    "@abstractmethod",
]

[dependency-groups]
dev = [
    # Testing
    "pytest>=7.4.0",
    "pytest-asyncio>=0.21.0",
    "pytest-cov>=4.1.0",
    "pytest-xdist>=3.3.0",
    "pyright>=1.1.389",
    "pre-commit>=3.5.0",
    "ruff>=0.1.0",
    # Type Stubs
    "types-beautifulsoup4",
]
