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

[project]
name = "bluetooth-data-tools"
version = "1.29.24"
license = "Apache-2.0"
description = "Tools for converting bluetooth data and packets"
authors = [{ name = "J. Nick Koston", email = "nick@koston.org" }]
readme = "README.md"
requires-python = ">=3.10"

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

[tool.poetry]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Natural Language :: English",
    "Operating System :: OS Independent",
    "Topic :: Software Development :: Libraries",
]
packages = [
    { include = "bluetooth_data_tools", from = "src" },
]

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

[tool.poetry.dependencies]
python = "^3.10"

# Documentation Dependencies
Sphinx = {version = ">=5,<9", optional = true}
sphinx-rtd-theme = {version = ">=1,<4", optional = true}
myst-parser = {version = ">=0.18,<4.1", optional = true}
cryptography = ">=47.0.0"

[tool.poetry.extras]
docs = [
    "myst-parser",
    "sphinx",
    "sphinx-rtd-theme",
]

[tool.poetry.group.benchmark.dependencies]
pytest-benchmark = ">=4,<6"

[tool.poetry.group.dev.dependencies]
pytest-codspeed = "^5.0.3"
pytest = "^9.0"
pytest-cov = "^7.1"

[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/bluetooth_data_tools/__init__.py:__version__",
    "docs/conf.py:release",
]
build_command = "pip install poetry && poetry build"
branch = "main"

[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]

[tool.coverage.run]
branch = true

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

[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 = "bench.*"
allow_untyped_defs = true

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

[tool.ruff]
exclude = ["docs"]
line-length = 88
target-version = "py310"

[tool.ruff.lint]
# `select`, not `extend-select`: extending builds on whatever ruff ships as its
# default selection, so a version bump can enable rules -- with autofixes -- that
# this project never opted into. Adopt new rules by editing this list.
select = [
    "B",
    "E",
    "F",
    "I", # isort
    "PLC0415", # import-outside-toplevel
    "S", # security (bandit)
    "W",
    "UP", # pyupgrade
]
extend-ignore = [
    "E501", # formatter will take care of line lengths
]

[tool.ruff.lint.per-file-ignores]
"tests/**/*" = [
    "S101", # assert ok in tests
    "S311", # fuzzer seeding does not need a crypto RNG
]

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