[project]
name = "pydantic-ai-middleware"
version = "0.2.2"
description = "Simple middleware library for Pydantic-AI - before/after hooks without imposed guardrails structure"
readme = "README.md"
license = "MIT"
requires-python = ">=3.10"
authors = [
    { name = "Pydantic AI Middleware Contributors" }
]
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Typing :: Typed",
]
dependencies = [
    "pydantic-ai-slim>=1.39",
    "pydantic>=2.0",
    "genai-prices>=0.0.49",
]

[project.optional-dependencies]
dev = [
    "pre-commit>=4.5.1",
    "ruff>=0.8.0",
    "pyright>=1.1.0",
]
yaml = [
    "PyYAML>=6.0",
]

[project.urls]
Homepage = "https://github.com/vstorm-co/pydantic-ai-middleware"
Documentation = "https://vstorm-co.github.io/pydantic-ai-middleware/"
Repository = "https://github.com/vstorm-co/pydantic-ai-middleware"
Issues = "https://github.com/vstorm-co/pydantic-ai-middleware/issues"

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

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

[dependency-groups]
dev = [
    "pytest>=9.0.0",
    "pytest-asyncio>=0.23.0",
    "coverage>=7.0.0",
    "build>=1.3.0",
    "twine>=6.2.0",
]
lint = [
    "ruff>=0.8.0",
    "pyright>=1.1.0",
    "mypy>=1.0.0",
]
docs = [
    "mkdocs>=1.6.0",
    "mkdocs-material>=9.5.0",
    "mkdocstrings>=0.26.0",
    "mkdocstrings-python>=1.12.0",
    "mkdocs-llmstxt>=0.2.0",
]

[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = [
    "E",      # pycodestyle errors
    "F",      # Pyflakes
    "I",      # isort
    "UP",     # pyupgrade
    "B",      # flake8-bugbear
    "SIM",    # flake8-simplify
    "Q",      # flake8-quotes
    "RUF100", # unused noqa
    "C90",    # mccabe complexity
]

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

[tool.ruff.format]
quote-style = "double"

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
asyncio_default_fixture_loop_scope = "function"

[tool.coverage.run]
branch = true
source = ["src/pydantic_ai_middleware"]
data_file = ".coverage/.coverage"

[tool.coverage.report]
fail_under = 100
skip_covered = true
show_missing = true
precision = 2
exclude_also = [
    "# pragma: no branch",
]
exclude_lines = [
    "pragma: no cover",
    "pragma: lax no cover",
    "if TYPE_CHECKING:",
    "@overload",
    "@abstractmethod",
    "raise NotImplementedError",
    "if __name__ == '__main__':",
    "except ImportError:",
    "pass",
    "\\.\\.\\.",
]

[tool.coverage.html]
directory = "htmlcov"

[tool.pyright]
pythonVersion = "3.10"
typeCheckingMode = "basic"
include = ["src/pydantic_ai_middleware"]
exclude = ["**/__pycache__", ".venv*", "site", "playground", "tests", "examples"]
reportMissingTypeStubs = false
reportUnknownMemberType = false
reportUnknownArgumentType = false
reportUnknownVariableType = false
reportUnknownParameterType = false
reportUnusedFunction = false
reportPrivateUsage = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportAssignmentType = false
reportTypedDictNotRequiredAccess = false

[tool.mypy]
python_version = "3.10"
strict = true
warn_return_any = true
warn_unused_configs = true
ignore_missing_imports = true
mypy_path = "src"
disable_error_code = ["override", "valid-type", "unused-ignore", "comparison-overlap"]

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disable_error_code = ["arg-type", "list-item", "abstract", "unused-ignore", "comparison-overlap"]

[[tool.mypy.overrides]]
module = "pydantic_ai_middleware.*"
disable_error_code = ["override", "valid-type", "assignment"]

[tool.codespell]
skip = ".git,.venv*,uv.lock,site,htmlcov,.coverage"
