[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme", "uv-dynamic-versioning>=0.14.0"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "uv-dynamic-versioning"

[tool.uv-dynamic-versioning]
vcs = "git"
style = "pep440"
bump = true
fallback-version = "0.0.0"

[project]
name = "httpx2"
description = "The next generation HTTP client."
license = "BSD-3-Clause"
requires-python = ">=3.10"
authors = [
    { name = "Tom Christie", email = "tom@tomchristie.com" },
]
maintainers = [
    { name = "Pydantic Services Inc.", email = "engineering@pydantic.dev" }
]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Environment :: Web Environment",
    "Framework :: AnyIO",
    "Framework :: AsyncIO",
    "Framework :: Trio",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: BSD License",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Programming Language :: Python :: 3.15",
    "Topic :: Internet :: WWW/HTTP",
]
dynamic = ["readme", "version", "dependencies"]

[tool.hatch.metadata.hooks.uv-dynamic-versioning]
dependencies = [
    "truststore>=0.10; sys_platform != 'emscripten'",
    "httpcore2=={{ version }}; sys_platform != 'emscripten'",
    "anyio>=4.10; sys_platform != 'emscripten'",
    "httpx2-jsfetch; sys_platform == 'emscripten' and python_version >= '3.12'",
    "idna>=3.18",
    "typing_extensions>=4.5.0; python_version < '3.13'",
]

[project.optional-dependencies]
brotli = [
    "brotli; platform_python_implementation == 'CPython'",
    "brotlicffi; platform_python_implementation != 'CPython'",
]
cli = [
    "click>=8.4.2",
    "pygments==2.*",
    "rich>=10,<16",
]
http2 = [
    "h2>=3,<5",
]
socks = [
    "socksio==1.*",
]
ws = [
    "wsproto>=1.2",
]
# TODO(Marcelo): Remove when Python 3.13 reaches EOL.
zstd = [
  "zstandard>=0.18.0; python_version <= '3.13'",
]

[project.scripts]
httpx2 = "httpx2._main:main"

[project.urls]
Changelog = "https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md"
Homepage = "https://github.com/pydantic/httpx2"
Source = "https://github.com/pydantic/httpx2"

[tool.hatch.build.targets.sdist]
include = ["/httpx2", "/CHANGELOG.md"]

[tool.hatch.build.targets.sdist.force-include]
"../../README.md" = "README.md"
"../../LICENSE.md" = "LICENSE.md"

[tool.hatch.build.targets.wheel]
packages = ["httpx2"]

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "../../README.md"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = "\n## Release Information\n\n"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "CHANGELOG.md"
pattern = "\n(###.+?\n)## "

[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = "\n---\n\n[Full changelog](https://github.com/pydantic/httpx2/blob/main/src/httpx2/CHANGELOG.md)\n"

[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = 'src="(docs/img/.*?)"'
replacement = 'src="https://raw.githubusercontent.com/pydantic/httpx2/main/\1"'
