[build-system]
requires = ["flit_core >=3.12"]
build-backend = "flit_core.buildapi"


[project]
name = "packaging"
description = "Core utilities for Python packages"
dynamic = ["version"]
license = "Apache-2.0 OR BSD-2-Clause"
readme = "README.rst"
requires-python = ">=3.9"
authors = [{name = "Donald Stufft", email = "donald@stufft.io"}]
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Intended Audience :: Developers",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.9",
  "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",
  "Programming Language :: Python :: Implementation :: CPython",
  "Programming Language :: Python :: Implementation :: PyPy",
  "Programming Language :: Python :: Free Threading :: 4 - Resilient",
  "Typing :: Typed",
]
dependencies = []

[project.urls]
Documentation = "https://packaging.pypa.io/"
Source = "https://github.com/pypa/packaging"


[dependency-groups]
test = [
  "coverage[toml]>=7.2.0",
  "hypothesis>=6.0.0",
  "pip>=21.1",
  "pretend",
  "pytest>=6.2.0",
  "tomli; python_version<'3.11'",
  "tomli_w",
]
docs = [
  "furo",
]
benchmark = [
  "asv",
  "pip",
]
dev = [
  { include-group = "test" },
  { include-group = "benchmark" },
]


[tool.flit.sdist]
include = ["tests/", "docs/", "CHANGELOG.rst"]
exclude = [
  "docs/_build",
  "tests/manylinux/build-hello-world.sh",
  "tests/musllinux/build.sh",
  "tests/hello-world.c",
  "tests/__pycache__",
  "build/__pycache__",
]

[tool.typos.default.extend-identifiers]
iMatix = "iMatix"
ANDed = "ANDed"
ORed = "ORed"

[tool.typos.default.extend-words]
dynamc = "dynamc"
notin = "notin"
nd = "nd"
tou = "tou"

[tool.coverage.run]
branch = true
source_pkgs = ["packaging"]

[tool.coverage.report]
show_missing = true
fail_under = 100
exclude_also = [
    "@(abc.)?abstractmethod",
    "@(abc.)?abstractproperty",
    "if (typing.)?TYPE_CHECKING:",
    "@(typing.)?overload",
    "def __dir__()",
]

[tool.pytest.ini_options]
minversion = "6.2"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config", "-m", "not property"]
xfail_strict = true
filterwarnings = ["error"]
log_level = "INFO"
testpaths = ["tests"]
markers = ["property: property-based tests (opt-in)"]


[tool.mypy]
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unused_ignores = true
python_version = "3.9"
files = ["src", "tests", "noxfile.py"]
native_parser = true

[[tool.mypy.overrides]]
module = ["_manylinux", "pretend"]
ignore_missing_imports = true

[tool.ruff]
extend-exclude = [
    "src/packaging/licenses/_spdx.py"
]
show-fixes = true

[tool.ruff.lint]
select = ["ALL"]
ignore = [
    "A002",    # function args shadowing builtins is fine
    "C9",      # complexity
    "COM812",  # trailing commas teach the formatter
    "CPY001",  # no copyright messages in files (for now)
    "D",       # doc formatting
    "EM",      # flake8-errmsg
    "ERA",     # commented out code
    "FBT",     # boolean positional args (existing API)
    "FIX",     # has todos
    "ISC004",  # unparenthesized implicit string concatenation in collection
    "N818",    # exceptions must end in "*Error"
    "PLR09",   # too many ...
    "PLR2004", # magic value in comparison
    "PLW0127", # duplicate of F821
    "PTH",     # pathlib
    "RET505",  # unused else/elif after return
    "RET506",  # unused else/elif after raise
    "RET507",  # unused else/elif after continue
    "RET508",  # unused else/elif after break
    "S101",    # assert is used by mypy and pytest
    "S105",    # the name token doesn't mean it's a password
    "S603",    # check for untrusted input
    "SIM103",  # returning negated value directly not ideal for long chain
    "SIM105",  # try/except is faster than contextlib.suppress
    "SLF001",  # private member access
    "TD",      # todo format
    "TRY003",  # long messages outside exception class
]
flake8-comprehensions.allow-dict-calls-with-keyword-arguments = true
flake8-unused-arguments.ignore-variadic-names = true

[tool.ruff.lint.per-file-ignores]
"tests/test_*.py" = ["PYI024", "PLR", "SIM201", "T20", "S301"]
"tasks/*.py" = ["T20"]
"tasks/check_frozen_revs.py" = ["ANN401"]
"tests/test_requirements.py" = ["UP032"]
"src/packaging/_musllinux.py" = ["T20"]
"docs/conf.py" = ["INP001", "S", "A001"]
"noxfile.py" = ["T20", "S"]
