[build-system]
requires = [
    "setuptools >= 64",
    "setuptools_scm >= 6.4"
]
build-backend = "setuptools.build_meta"

[project]
name = "anyio"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
readme = "README.rst"
authors = [{name = "Alex Grönholm", email = "alex.gronholm@nextday.fi"}]
license = {text = "MIT"}
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Framework :: AnyIO",
    "Typing :: Typed",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
]
requires-python = ">= 3.8"
dependencies = [
    "exceptiongroup >= 1.0.2; python_version < '3.11'",
    "idna >= 2.8",
    "sniffio >= 1.1",
    "typing_extensions >= 4.1; python_version < '3.11'",
]
dynamic = ["version"]

[project.urls]
Documentation = "https://anyio.readthedocs.io/en/latest/"
Changelog = "https://anyio.readthedocs.io/en/stable/versionhistory.html"
"Source code" = "https://github.com/agronholm/anyio"
"Issue tracker" = "https://github.com/agronholm/anyio/issues"

[project.optional-dependencies]
trio = ["trio >= 0.23"]
test = [
    "anyio[trio]",
    "coverage[toml] >= 7",
    "exceptiongroup >= 1.2.0",
    "hypothesis >= 4.0",
    "psutil >= 5.9",
    "pytest >= 7.0",
    "pytest-mock >= 3.6.1",
    "trustme",
    "uvloop >= 0.17; platform_python_implementation == 'CPython' and platform_system != 'Windows'",
]
doc = [
    "packaging",
    "Sphinx >= 7",
    "sphinx_rtd_theme",
    "sphinx-autodoc-typehints >= 1.2.0",
]

[project.entry-points]
pytest11 = {anyio = "anyio.pytest_plugin"}

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "dirty-tag"

[tool.ruff]
src = ["src"]

[tool.ruff.lint]
extend-select = [
    "ASYNC",        # flake8-async
    "W",            # pycodestyle warnings
    "G",            # flake8-logging-format
    "I",            # isort
    "ISC",          # flake8-implicit-str-concat
    "PGH",          # pygrep-hooks
    "RUF100",       # unused noqa (yesqa)
    "T201",         # print
    "UP",           # pyupgrade
]

[tool.ruff.lint.isort]
"required-imports" = ["from __future__ import annotations"]

[tool.mypy]
python_version = "3.12"
strict = true
ignore_missing_imports = true
disallow_any_generics = false
warn_return_any = false
disallow_untyped_decorators = false
disallow_subclassing_any = false
show_error_codes = true

[tool.pytest.ini_options]
addopts = "-rsx --tb=short --strict-config --strict-markers -p anyio -p no:asyncio -p no:trio"
testpaths = ["tests"]
xfail_strict = true
# Ignore resource warnings due to a CPython/Windows bug (https://bugs.python.org/issue44428)
filterwarnings = [
    "error",
    "ignore:unclosed <socket.socket.*:ResourceWarning",
    "ignore:unclosed transport <_ProactorSocketTransport.*:ResourceWarning",
    "ignore:ast.Str is deprecated:DeprecationWarning",
    "ignore:Attribute s is deprecated:DeprecationWarning",
    "ignore:ast.NameConstant is deprecated:DeprecationWarning",
    # Workaround for Python 3.9.7 (see https://bugs.python.org/issue45097)
    "ignore:The loop argument is deprecated since Python 3\\.8, and scheduled for removal in Python 3\\.10\\.:DeprecationWarning:asyncio",
]
markers = [
    "network: marks tests as requiring Internet access",
]

[tool.coverage.run]
source = ["anyio"]
relative_files = true

[tool.coverage.report]
show_missing = true

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = pre-commit, py38, py39, py310, py311, py312, pypy3
skip_missing_interpreters = true
minversion = 4.0.0

[testenv]
depends = pre-commit
package = editable
commands = coverage run -m pytest {posargs}
extras = test

[testenv:pypy3]
commands = pytest {posargs}

[testenv:pre-commit]
depends =
basepython = python3
package = skip
deps = pre-commit
commands = pre-commit run --all-files

[testenv:pyright]
deps = pyright
commands = pyright --verifytypes anyio

[testenv:docs]
depends =
extras = doc
commands = sphinx-build -W docs build/sphinx
"""
