[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

# Project configuration variables
[tool.project-config]
min_coverage_percentage = 91

[project]
name = "okta-opa"
version = "0.1.2"
description = "Python script for working with Okta APIs, esp OPA"
readme = "README.md"
requires-python = ">=3.11"
license = "Apache-2.0"
authors = [
    {name = "Lynker Pypi Admin", email = "pypi@lynker.com"},
    {name = "Mykel Alvis", email = "malvis@lynker.com"}
]
keywords = ["api", "requests", "okta"]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: Apache Software License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
]

dependencies = [
    "requests>=2.32.0",
    "click>=8.0.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0.0",
    "pytest-cov>=4.0.0",
    "coverage[toml]>=7.0.0",
    "black>=23.0.0",
    "ruff>=0.1.0",
    "mypy>=1.0.0",
    "types-requests>=2.31.0",
]

[project.urls]
Homepage = "https://github.com/LynkerIntel/okta-opa-script"
Repository = "https://github.com/LynkerIntel/okta-opa-script"
Issues = "https://github.com/LynkerIntel/okta-opa-script/issues"

[project.scripts]
okta-server-enrollment-token = "okta_api_script.cli:cli"

[tool.hatch.build.targets.wheel]
packages = ["src/main/python/okta_api_script", "src/main/python/services" ]

[tool.black]
line-length = 88
target-version = ["py311"]
include = '\.pyi?$'
exclude = '''
/(
  \.git
  | \.venv
  | \.uv
  | build
  | dist
  | \.eggs
  | \.mypy_cache
  | \.pytest_cache
  | __pycache__
)/
'''

[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true

# Allow Any returns for JSON responses since we can't predict the structure
[[tool.mypy.overrides]]
module = "okta_api_script.main"
warn_return_any = false

[tool.pytest.ini_options]
minversion = "6.0"
# Coverage threshold defined in [tool.project-config] section above (91%)
addopts = "-ra -q --cov=src/main/python/ --cov-report=term-missing --cov-fail-under=91"
testpaths = [
    "src/test/python",
]

[tool.coverage.run]
source = ["src/main/python/"]
branch = true

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "if self.debug:",
    "if settings.DEBUG",
    "raise AssertionError",
    "raise NotImplementedError",
    "if 0:",
    "if __name__ .__main__.:",
]
# Coverage threshold defined in [tool.project-config] section above (91%)
fail_under = 91
show_missing = true

[tool.ruff]
line-length = 88
target-version = "py311"
include = [
    "src/main/python/**/*.py",
    "src/test/python/**/*.py",
]
exclude = [
    ".git",
    "__pycache__",
    ".venv",
    ".env",
    "venv",
    "env",
    "build",
    "dist",
    "*.egg-info",
    ".pytest_cache",
    ".mypy_cache",
]

[tool.ruff.lint]
select = [
    "E",    # pycodestyle errors
    "W",    # pycodestyle warnings
    "F",    # pyflakes
    "I",    # isort
    "B",    # flake8-bugbear
    "C4",   # flake8-comprehensions
    "UP",   # pyupgrade
]
ignore = [
    "E203",  # space before ':' (conflicts with black)
]

[tool.ruff.lint.isort]
known-first-party = ["okta_api_script"]

