[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "django-query-doctor"
version = "2.0.0"
description = "Automated Django ORM query diagnosis and optimization. SQL compilation caching, prepared statements, N+1 detection, and DRF analysis."
readme = "README.md"
license = "MIT"
requires-python = ">=3.10"
authors = [{ name = "Hassan Zaib Hayat", email = "hassanzaibhayatske@gmail.com" }]
classifiers = [
    "Development Status :: 4 - Beta",
    "Framework :: Django",
    "Framework :: Django :: 4.2",
    "Framework :: Django :: 5.0",
    "Framework :: Django :: 5.1",
    "Framework :: Django :: 5.2",
    "Framework :: Django :: 6.0",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Database",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Software Development :: Quality Assurance",
]
keywords = [
    "django", "orm", "query", "optimization", "n+1", "performance",
    "sql", "cache", "prepared-statements", "drf", "rest-framework",
    "profiling", "diagnosis",
]
dependencies = ["django>=4.2"]

[project.optional-dependencies]
rich = ["rich>=13.0"]
celery = ["celery>=5.0"]
otel = ["opentelemetry-api>=1.0", "opentelemetry-sdk>=1.0"]
all = ["django-query-doctor[rich,celery,otel]"]
docs = [
    "mkdocs-material>=9.5",
    "mkdocstrings[python]>=0.24",
    "mkdocs-git-revision-date-localized-plugin>=1.2",
]
dev = [
    "pytest>=8.0",
    "pytest-django>=4.7",
    "pytest-cov>=4.0",
    "factory-boy>=3.3",
    "ruff>=0.4",
    "mypy>=1.8",
    "django-stubs>=4.2",
    "djangorestframework>=3.14",
    "asgiref>=3.7",
]

[project.entry-points.pytest11]
query_doctor = "query_doctor.pytest_plugin"

[project.urls]
Homepage = "https://github.com/hassanzaibhay/django-query-doctor"
Documentation = "https://hassanzaibhay.github.io/django-query-doctor"
Repository = "https://github.com/hassanzaibhay/django-query-doctor"
Changelog = "https://github.com/hassanzaibhay/django-query-doctor/blob/main/CHANGELOG.md"
"Bug Tracker" = "https://github.com/hassanzaibhay/django-query-doctor/issues"

[tool.hatch.build.targets.sdist]
exclude = [
    "benchmarks/report.html",
    "benchmarks/results.json",
    "PROJECT_AUDIT.md",
]

[tool.hatch.build.targets.wheel]
packages = ["src/query_doctor"]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tests.settings"
pythonpath = [".", "src"]
addopts = "-v --tb=short -p no:query_doctor"

[tool.ruff]
src = ["src", "tests"]
line-length = 99
target-version = "py310"

[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP", "B", "A", "SIM", "RUF"]

[tool.mypy]
python_version = "3.10"
plugins = ["mypy_django_plugin.main"]
strict = true
warn_return_any = true

[[tool.mypy.overrides]]
module = ["rest_framework.*", "rich.*", "opentelemetry.*"]
ignore_missing_imports = true

[tool.coverage.run]
source = ["src/query_doctor"]

[tool.coverage.report]
show_missing = true
fail_under = 85
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
    "if HAS_CELERY",
    "if HAS_OTEL",
    "if HAS_RICH",
    "except ImportError",
    "raise NotImplementedError",
]

[tool.django-stubs]
django_settings_module = "tests.settings"
