[project]
name = "habluetooth"
version = "3.32.0"
license.text = "Apache-2.0"
description = "High availability Bluetooth"
authors = [{ name = "J. Nick Koston", email = "bluetooth@koston.org" }]
readme = "README.md"
requires-python = ">=3.11"

[project.urls]
"Repository" = "https://github.com/bluetooth-devices/habluetooth"
"Documentation" = "https://habluetooth.readthedocs.io"
"Bug Tracker" = "https://github.com/bluetooth-devices/habluetooth/issues"
"Changelog" = "https://github.com/bluetooth-devices/habluetooth/blob/main/CHANGELOG.md"

[tool.poetry]
classifiers = [
    "Development Status :: 2 - Pre-Alpha",
    "Intended Audience :: Developers",
    "Natural Language :: English",
    "Operating System :: OS Independent",
    "Topic :: Software Development :: Libraries",
]
packages = [
    { include = "habluetooth", from = "src" },
]

[tool.poetry.build]
generate-setup-file = true
script = "build_ext.py"

[tool.poetry.dependencies]
python = ">=3.11,<3.14"
bleak = ">=0.21.1"
bleak-retry-connector = ">=3.9.0"
bluetooth-data-tools = ">=1.16.0"
bluetooth-adapters = ">=0.16.1"
bluetooth-auto-recovery = ">=1.2.3"
async-interrupt = ">=1.1.1"

[tool.poetry.group.dev.dependencies]
pytest = ">=7,<9"
pytest-cov = ">=3,<7"
pytest-asyncio = ">=0.23.6,<0.26.0"
pytest-codspeed = ">=2.2.1,<4.0.0"
freezegun = "^1.5.1"
dbus-fast = ">=2.30.2"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
myst-parser = ">=0.16"
sphinx = ">=4.0"
furo = ">=2023.5.20"
sphinx-autobuild = ">=2021.3.14"

[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
version_variables = [
    "src/habluetooth/__init__.py:__version__",
    "docs/conf.py:release",
]
build_command = "pip install poetry && poetry build"

[tool.semantic_release.changelog]
exclude_commit_patterns = [
    "chore*",
    "ci*",
]

[tool.semantic_release.changelog.environment]
keep_trailing_newline = true

[tool.semantic_release.branches.main]
match = "main"

[tool.semantic_release.branches.noop]
match = "(?!main$)"
prerelease = true

[tool.pytest.ini_options]
addopts = "-v -Wdefault --cov=habluetooth --cov-report=term-missing:skip-covered"
pythonpath = ["src"]
log_cli="true"
log_level="NOTSET"

[tool.coverage.run]
branch = true

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "@overload",
    "if TYPE_CHECKING",
    "raise NotImplementedError",
    'if __name__ == "__main__":',
]

[tool.ruff]
target-version = "py38"
line-length = 88
ignore = [
    "E721", # type checks for cython
    "D203", # 1 blank line required before class docstring
    "D212", # Multi-line docstring summary should start at the first line
    "D100", # Missing docstring in public module
    "D104", # Missing docstring in public package
    "D107", # Missing docstring in `__init__`
    "D401", # First line of docstring should be in imperative mood
]
select = [
    "B",   # flake8-bugbear
    "D",   # flake8-docstrings
    "C4",  # flake8-comprehensions
    "S",   # flake8-bandit
    "F",   # pyflake
    "E",   # pycodestyle
    "W",   # pycodestyle
    "UP",  # pyupgrade
    "I",   # isort
    "RUF", # ruff specific
]

[tool.ruff.per-file-ignores]
"tests/**/*" = [
    "D100",
    "D101",
    "D102",
    "D103",
    "D104",
    "S101",
]
"setup.py" = ["D100"]
"conftest.py" = ["D100"]
"docs/conf.py" = ["D100"]

[tool.ruff.isort]
known-first-party = ["habluetooth", "tests"]

[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
mypy_path = "src/"
no_implicit_optional = true
show_error_codes = true
warn_unreachable = true
warn_unused_ignores = true
exclude = [
    'docs/.*',
    'setup.py',
]

[[tool.mypy.overrides]]
module = "tests.*"
allow_untyped_defs = true

[[tool.mypy.overrides]]
module = "docs.*"
ignore_errors = true

[build-system]
requires = ['setuptools>=75.8.0', 'Cython>=3', "poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"
