[build-system]
requires = ['hatchling>=1.27.0', 'hatch-vcs>=0.4.0']
build-backend = 'hatchling.build'
[tool.hatch.build.targets.wheel]
packages = ['src/twat_search']
[tool.hatch.build.hooks.vcs]
version-file = 'src/twat_search/__version__.py'

[tool.hatch.version]
source = 'vcs'

[tool.hatch.version.raw-options]
version_scheme = 'post-release'

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.envs.default]
dependencies = [
    'pytest>=1.3.4',
    'pytest-cov>=1.0.0',
    'mypy>=1.15.0',
    'ruff>=0.9.7',
    'absolufy-imports>=0.3.1',
    'pre-commit>=4.1.0',
    'pyupgrade>=3.19.1',
    'isort>=6.0.0',
]

[tool.hatch.envs.default.scripts]
test = 'pytest {args:tests}'
test-cov = 'pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/twat_search --cov=tests {args:tests}'
type-check = 'mypy src/twat_search tests'
lint = ['ruff check src/twat_search tests', 'ruff format src/twat_search tests']
[[tool.hatch.envs.all.matrix]]
python = ['3.10', '3.11', '3.12']

[tool.hatch.envs.lint]
detached = true
dependencies = [
    'mypy>=1.15.0',
    'ruff>=0.9.7',
    'absolufy-imports>=0.3.1',
    'pre-commit>=4.1.0',
    'pyupgrade>=3.19.1',
    'isort>=6.0.1',
]

[tool.hatch.envs.lint.scripts]
typing = 'mypy --install-types --non-interactive {args:src/twat_search tests}'
style = ['ruff check {args:.}', 'ruff format {args:.}']
fmt = ['ruff format {args:.}', 'ruff check --fix {args:.}']
all = ['style', 'typing']

[tool.hatch.envs.test]
dependencies = ['.[test]']

[tool.hatch.envs.test.scripts]
test = 'python -m pytest -n auto {args:tests}'
test-cov = 'python -m pytest -n auto --cov-report=term-missing --cov-config=pyproject.toml --cov=src/twat_search --cov=tests {args:tests}'
bench = 'python -m pytest -v -p no:briefcase tests/test_benchmark.py --benchmark-only'
bench-save = 'python -m pytest -v -p no:briefcase tests/test_benchmark.py --benchmark-only --benchmark-json=benchmark/results.json'

[tool.ruff]
target-version = 'py310'
line-length = 120

[tool.ruff.lint]
select = [
    'A',
    'ARG',
    'B',
    'C',
    'DTZ',
    'E',
    'EM',
    'F',
    'FBT',
    'I',
    'ICN',
    'ISC',
    'N',
    'PLC',
    'PLE',
    'PLR',
    'PLW',
    'PT',
    'PTH',
    'PYI',
    'RET',
    'RSE',
    'RUF',
    'S',
    'SIM',
    'T',
    'TCH',
    'TID',
    'UP',
    'W',
    'YTT',
]
ignore = [
    'B027',
    'C901',
    'FBT003',
    'PLR0911',
    'PLR0912',
    'PLR0913',
    'PLR0915',
    'PLR1714',
    'PLW0603',
    'PT013',
    'PTH123',
    'PYI056',
    'S105',
    'S106',
    'S107',
    'S110','SIM102'
]
unfixable = [
    # Don't touch unused imports
    'F401',
]

[tool.ruff.lint.isort]
known-first-party = ['twat_search']

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = 'all'

[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
'tests/**/*' = ['PLR2004', 'S101', 'TID252']

[tool.coverage.run]
source_pkgs = ['twat_search', 'tests']
branch = true
parallel = true
omit = ['src/twat_search/__about__.py']

[tool.coverage.paths]
twat_search = ['src/twat_search', '*/twat-search/src/twat_search']
tests = ['tests', '*/twat-search/tests']

[tool.coverage.report]
exclude_lines = [
    'no cov',
    'if __name__ == .__main__.:',
    'if TYPE_CHECKING:',
    'pass',
    'raise NotImplementedError',
    'raise ImportError',
    'except ImportError',
    'except KeyError',
    'except AttributeError',
    'except NotImplementedError',
]

[project]
name = 'twat-search'
description = 'Web search plugin for twat'
readme = 'README.md'
requires-python = '>=3.10'
license = { text = 'MIT' }
keywords = []
dynamic = ["version"]
classifiers = [
    'Development Status :: 4 - Beta',
    'Programming Language :: Python',
    'Programming Language :: Python :: 3.10',
    'Programming Language :: Python :: 3.11',
    'Programming Language :: Python :: 3.12',
    'Programming Language :: Python :: Implementation :: CPython',
    'Programming Language :: Python :: Implementation :: PyPy',
]
dependencies = [
    'twat>=1.8.1',
    'pydantic>=2.10.6',
    'pydantic-settings>=2.8.1',
    'httpx>=0.28.1',
    'python-dotenv>=1.0.1',
    'fire>=0.7.0',
    'rich>=13.9.4',
    'requests>=2.32.3',
    'beautifulsoup4>=4.13.0',
]

[[project.authors]]
name = 'Adam Twardoch'
email = 'adam+github@twardoch.com'

[project.urls]
Documentation = 'https://github.com/twardoch/twat-search#readme'
Issues = 'https://github.com/twardoch/twat-search/issues'
Source = 'https://github.com/twardoch/twat-search'
[project.entry-points."twat.plugins"]
search = 'twat_search'

[project.optional-dependencies]
test = [
    'pytest>=8.3.4',
    'pytest-cov>=6.0.0',
    'pytest-xdist>=3.6.1',
    'pytest-benchmark[histogram]>=5.1.0',
    'pytest-asyncio>=0.25.3',
]
dev = [
    'pre-commit>=4.1.0',
    'ruff>=0.9.7',
    'mypy>=1.15.0',
    'absolufy-imports>=0.3.1',
    'pyupgrade>=3.19.1',
    'isort>=6.0.1',
]
brave = []
duckduckgo = ['duckduckgo-search>=7.5.0']
bing_scraper = ['scrape-bing>=0.1.2.1']
tavily = ['tavily-python>=0.5.1']
pplx = []
serpapi = ['serpapi>=0.1.5']
hasdata = []
falla = [    "lxml>=5.3.1",
    "playwright>=1.50.0",
]
google_scraper = ['googlesearch-python>=1.3.0']
all = [
    'twat',
    'duckduckgo-search>=7.5.0',
    'scrape-bing>=0.1.2.1',
    'tavily-python>=0.5.1',
    'serpapi>=0.1.5',
    'googlesearch-python>=1.3.0',
    'beautifulsoup4>=4.13.0',
    'lxml>=5.3.1',
    'playwright>=1.50.0',
]

[project.scripts]
twat-search = 'twat_search.__main__:main'
twat-search-web = 'twat_search.web.cli:main'
