[build-system]
requires = ["setuptools >= 75"]
build-backend = "setuptools.build_meta"

[project]
name = "sigstore-rekor-types"
dynamic = ["version"]
description = "Python models for Rekor's API types"
readme = "README.md"
license = { file = "LICENSE" }
authors = [{ name = "Trail of Bits", email = "opensource@trailofbits.com" }]
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: Apache Software License",
]
dependencies = [
    "pydantic[email] >=2,<3",
    "typing-extensions; python_version < '3.9'",
]
requires-python = ">=3.8"

[project.optional-dependencies]
doc = ["pdoc >= 14.2,< 16.0"]
lint = [
    # NOTE: ruff is under active development, so we pin conservatively here
    # and let Dependabot periodically perform this update.
    "ruff < 0.7.5",
    "mypy >= 1.0",
]
codegen = ["datamodel-code-generator>=0.25.2", "sigstore-rekor-types[lint]"]
dev = ["sigstore-rekor-types[codegen,doc,lint]", "build"]

[tool.setuptools]
package-dir = { "" = "src" }

[tool.setuptools.dynamic]
version = { attr = "rekor_types.__version__" }

[project.urls]
Homepage = "https://pypi.org/project/sigstore-rekor-types"
Documentation = "https://trailofbits.github.io/sigstore-rekor-types/"
Issues = "https://github.com/trailofbits/sigstore-rekor-types/issues"
Source = "https://github.com/trailofbits/sigstore-rekor-types"


[tool.mypy]
allow_redefinition = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
sqlite_cache = true
strict_equality = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[tool.ruff]
line-length = 100
select = ["ALL"]

[tool.ruff.per-file-ignores]
"src/rekor_types/__init__.py" = [
    "TCH001", # False positive: imports are re-exports, not just for type hints.
]
"src/rekor_types/_internal/*.py" = [
    "A003",   # some fields shadow python builtins
    "E501",   # handled by black, and catches some docstrings we can't autofix
    "ERA001", # false positives
    "D400",   # overly opinionated docstrings
    "D415",   # overly opinionated docstrings
    "UP006",  # pydantic doesn't support PEP 585 below Python 3.9
    "UP007",  # pydantic doesn't support PEP 604 below Python 3.10
]
"test/**/*.py" = [
    "D",    # no docstrings in tests
    "S101", # asserts are expected in tests
]
