[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"

[project]
name = "auroraview"
version = "0.3.25" # x-release-please-version
description = "AuroraView: Rust-powered WebView for Python apps & DCC embedding"
authors = [
    {name = "Hal Long", email = "hal.long@outlook.com"}
]
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.7"
keywords = ["webview", "dcc", "maya", "houdini", "blender", "rust", "pyo3"]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.7",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Rust",
    "Topic :: Multimedia :: Graphics",
    "Topic :: Software Development :: Libraries :: Python Modules",
]

dependencies = [
    "typing_extensions>=4.0.0; python_version<'3.8'"
]

[project.optional-dependencies]
qt = [
    "qtpy>=2.0.0",
    "pytest-qt>=4.2.0",
]

[dependency-groups]
test = [
    "pytest>=7.0",
    "pytest-cov>=4.0",
    "pytest-asyncio>=0.21.0",
    "pytest-timeout>=2.0.0",
    "coverage[toml]>=7.0",
    "websockets>=10.0",
    "playwright>=1.40.0; python_version>='3.8'",
]
playwright = [
    "playwright>=1.40.0; python_version>='3.8'",
]
dev = [
    { include-group = "test" },
    "ruff>=0.8.0",
    "mypy>=1.0",
    "maturin>=1.0",
]

[project.urls]
Homepage = "https://github.com/loonghao/auroraview"
Documentation = "https://github.com/loonghao/auroraview#readme"
Repository = "https://github.com/loonghao/auroraview"
Issues = "https://github.com/loonghao/auroraview/issues"

[project.scripts]
auroraview = "auroraview.__main__:main"

[tool.maturin]
python-source = "python"
module-name = "auroraview._core"
# Note: abi3-py38 for Python 3.8+, Python 3.7 requires separate non-abi3 build
features = ["python-bindings", "pyo3/extension-module", "abi3-py38"]
bindings = "pyo3"

# Ruff configuration
[tool.ruff]
line-length = 100
target-version = "py37"

[tool.ruff.lint]
select = [
    "E",  # pycodestyle errors
    "W",  # pycodestyle warnings
    "F",  # pyflakes
    "I",  # isort
    "B",  # flake8-bugbear
    "C4", # flake8-comprehensions
]
ignore = [
    "E501",  # line too long, handled by formatter
    "B008",  # do not perform function calls in argument defaults
    "C901",  # too complex
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "E402", "I001"]
"tests/test_nuke_ipc.py" = ["W293", "I001"]

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

# MyPy configuration
[tool.mypy]
python_version = "3.7"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
follow_imports = "normal"
strict_optional = true

# Pytest configuration
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q --strict-markers --cov=auroraview --cov-report=term-missing --cov-report=html --cov-report=xml --timeout=60"
testpaths = ["tests/python/unit", "tests/python/integration"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
timeout = 60
timeout_method = "thread"
markers = [
    "unit: Unit tests",
    "integration: Integration tests",
    "slow: Slow running tests (deselect with '-m \"not slow\"')",
    "ui: UI tests (requires display)",
    "maya: Maya-specific tests",
    "qt: Qt-specific tests",
    "headless: Headless tests (no display required)",
    "e2e: End-to-end tests",
]

# Coverage configuration
[tool.coverage.run]
source = ["auroraview"]
omit = [
    "*/tests/*",
    "*/__pycache__/*",
    # Omit environment-dependent GUI backends from coverage stats
    "*/auroraview/qt_integration.py",
    "*/auroraview/webview.py",
]

[tool.coverage.report]
# Note: Lower threshold due to GUI-dependent code that requires display environment
fail_under = 35
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "raise AssertionError",
    "raise NotImplementedError",
    "if __name__ == .__main__.:",
    "if TYPE_CHECKING:",
    "class .*\\bProtocol\\):",
    "@(abc\\.)?abstractmethod",
]

