[tool.uv]
package = false
default-groups = ["dev", "docs", "bench"]
required-version = ">=0.8.6"
exclude-newer = "7 days"
exclude-newer-package = { idna = "2026-06-03T00:00:00Z", httpx2-jsfetch = "2026-08-08T00:00:00Z" }

[tool.uv.workspace]
members = ["src/httpx2", "src/httpcore2"]

[tool.uv.sources]
httpcore2 = { workspace = true }
httpx2 = { workspace = true }

[dependency-groups]
dev = [
  "httpx2[brotli,cli,http2,socks,ws,zstd]",
  "httpcore2[asyncio,trio,http2,socks]",
  # Tests
  "chardet==6.0.0.post1",
  "coverage[toml]==7.15.2",
  "cryptography>=49.0.0",
  "flaky>=3.8",
  "pytest>=9.1.0",
  "pytest-codspeed>=5.0.3",
  "pytest-httpbin==2.1.0",
  "pytest-trio==0.8.0",
  "starlette>=0.49",
  "trio==0.33.0",
  "trio-typing==0.10.0",
  "trustme==1.2.1",
  "uvicorn>=0.52.0",
  "websockets>=16.1.1",
  "werkzeug>=3.1.6",
  # Linting
  "mypy==2.3.0",
  "ruff==0.16.0",
  # Packaging
  "build==1.5.0",
  "twine==7.0.0",
]
docs = ["zensical>=0.0.51", "mkdocstrings[python]>=1.0.6"]
bench = [
  "aiohttp>=3.14.3",
  "matplotlib>=3.9",
  "pyinstrument>=4.6.2",
  "urllib3>=2.2.2",
]

[tool.ruff]
line-length = 120
exclude = ["src/httpcore2/httpcore2/_sync", "tests/httpcore2/_sync"]
extend-exclude = ["*.md"]

[tool.ruff.lint]
select = ["B", "C4", "E", "F", "I", "PERF", "PIE", "UP", "W"]
ignore = ["B904", "B028", "C401", "PERF203"]

[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = ["httpx2", "httpcore2"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F403", "F405"]

[tool.mypy]
ignore_missing_imports = true
strict = true

[tool.pytest.ini_options]
addopts = "-rxXs --import-mode=importlib"
testpaths = ["tests"]
filterwarnings = [
  "error",
  "ignore: You seem to already have a custom sys.excepthook handler installed. I'll skip installing Trio's custom handler, but this means MultiErrors will not show full tracebacks.:RuntimeWarning",
  # See: https://github.com/agronholm/anyio/issues/508
  "ignore: trio.MultiError is deprecated since Trio 0.22.0:trio.TrioDeprecationWarning",
]
markers = [
  "copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accommodate e.g. our test setup",
  "network: marks tests which require network connection. Used in 3rd-party build environments that have network disabled.",
  "benchmark: marks CodSpeed benchmark tests under tests/test_benchmark*.py.",
]

[tool.coverage.run]
source_pkgs = ["httpx2", "httpcore2", "tests"]
omit = ["src/httpcore2/httpcore2/_sync/*", "tests/test_benchmark*.py"]

[tool.coverage.report]
exclude_also = [
  "if TYPE_CHECKING:",
  "if (typing|_typing).TYPE_CHECKING:",
  "raise NotImplementedError",
  "@(typing\\.)?overload",
]
