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

[project]
name = "sendspin"
# The version is set by GH action on release
authors = [
  { name = "Sendspin Protocol Authors", email = "sendspin@openhomefoundation.org" },
]
classifiers = [
  "Environment :: Console",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
]
dependencies = [
  "aiosendspin~=4.3",
  "aiosendspin-mpris~=2.1.1",
  "av>=14.0.0",
  "numpy>=1.24.0",
  "pulsectl-asyncio>=1.2.2; platform_system == 'Linux'",
  "qrcode>=8.0",
  "readchar>=4.0.0",
  "rich>=13.0.0",
  "sounddevice>=0.4.6",
]

description = "Synchronized audio player for Sendspin servers"
license = { text = "Apache-2.0" }
readme = "README.md"
requires-python = ">=3.12"
version = "5.7.0"

[project.urls]
"Homepage" = "https://github.com/Sendspin-Protocol/sendspin"
"Bug Tracker" = "https://github.com/Sendspin-Protocol/sendspin/issues"

[project.scripts]
sendspin = "sendspin.cli:main"

[project.optional-dependencies]
cast = ["pychromecast>=14.0.0"]
test = [
  "codespell==2.4.1",
  "mypy==1.18.2",
  "pre-commit==4.4.0",
  "pre-commit-hooks==6.0.0",
  "pytest>=8.4.2",
  "ruff==0.14.5",
]

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

[tool.setuptools.package-data]
"sendspin.serve" = ["web/*"]

[tool.codespell]
# ignore-words-list = ""

[tool.ruff]
fix = true
show-fixes = true

line-length = 100
target-version = "py312"

[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "pep257"

[tool.ruff.lint.pylint]

max-args = 10
max-branches = 25
max-returns = 15
max-statements = 50

[tool.mypy]
platform = "linux"
python_version = "3.12"
follow_imports = "normal"

# suppress errors about unsatisfied imports
ignore_missing_imports = true

# be strict
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
enable_error_code = ["ignore-without-code", "redundant-self", "truthy-iterable"]
extra_checks = false
local_partial_types = true
no_implicit_optional = true
no_implicit_reexport = true
show_error_codes = true
strict_equality = true
strict_optional = true
warn_incomplete_stub = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

packages = ["sendspin"]

[tool.ruff.format]
# Force Linux/macOS line endings
line-ending = "lf"

[tool.ruff.lint]
ignore = [
  "ANN002",  # Just annoying, not really useful
  "ANN003",  # Just annoying, not really useful
  "ANN401",  # Opinioated warning on disallowing dynamically typed expressions
  "D203",    # Conflicts with other rules
  "D213",    # Conflicts with other rules
  "D417",    # False positives in some occasions
  "EM101",   # Just annoying, not really useful
  "EM102",   # Just annoying, not really useful
  "FIX002",  # Just annoying, not really useful
  "PLR2004", # Just annoying, not really useful
  "PGH004",  # Just annoying, not really useful
  "PD011",   # Just annoying, not really useful
  "S101",    # assert is often used to satisfy type checking
  "TC001",   # Just annoying, not really useful
  "TC003",   # Just annoying, not really useful
  "TD002",   # Just annoying, not really useful
  "TD003",   # Just annoying, not really useful
  "TD004",   # Just annoying, not really useful
  "TRY003",  # Just annoying, not really useful
  "TRY400",  # Just annoying, not really useful
  "COM812",  # Conflicts with the Ruff formatter
  "S104",    # Allow "0.0.0.0" address
]

[tool.ruff.lint.per-file-ignores]
"sendspin/cli.py" = ["T201"]
"sendspin/serve/__init__.py" = ["T201"]
"setup.py" = ["T201"]

select = ["ALL"]

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

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

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