[build-system]
requires = [ "setuptools>=65.0.0", "wheel" ]
build-backend = "setuptools.build_meta"

[project]
name = "delaunay-scripts"
version = "0.4.1"
description = "Python utility scripts for the delaunay Rust library"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "BSD-3-Clause" }
authors = [ { name = "Adam Getchell", email = "adam@adamgetchell.org" } ]
keywords = [ "delaunay", "triangulation", "benchmarking", "utilities" ]
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "Intended Audience :: Science/Research",
    "License :: OSI Approved :: BSD License",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering :: Mathematics",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: System :: Benchmarking",
]

# Project dependencies
dependencies = [ "packaging" ]

[project.urls]
"Homepage" = "https://github.com/acgetchell/delaunay"
"Documentation" = "https://docs.rs/delaunay"
"Repository" = "https://github.com/acgetchell/delaunay"
"Bug Tracker" = "https://github.com/acgetchell/delaunay/issues"

# Configure scripts as entry points for command-line usage
[project.scripts]
archive-changelog = "archive_changelog:main"
benchmark-utils = "benchmark_utils:main"
compare-storage-backends = "compare_storage_backends:main"
hardware-utils = "hardware_utils:main"
postprocess-changelog = "postprocess_changelog:main"
tag-release = "tag_release:main"

# Configure setuptools to find packages in scripts/ directory
[tool.setuptools]
package-dir = { "" = "scripts" }
py-modules = [
    "archive_changelog",
    "benchmark_utils",
    "compare_storage_backends",
    "hardware_utils",
    "postprocess_changelog",
    "subprocess_utils",
    "tag_release",
]

[tool.ruff]
line-length = 150
target-version = "py311"
src = [ "scripts" ]

[tool.ruff.lint]
select = [
    "E",
    "F",
    "W",
    "I",
    "N",
    "UP",
    "YTT",
    "ASYNC",
    "S",
    "BLE",
    "FBT",
    "B",
    "A",
    "COM",
    "C4",
    "DTZ",
    "FA",
    "T10",
    "EM",
    "EXE",
    "FIX",
    "FLY",
    "FURB",
    "ISC",
    "ICN",
    "LOG",
    "G",
    "INP",
    "PERF",
    "PIE",
    "T20",
    "PYI",
    "PT",
    "Q",
    "RSE",
    "RET",
    "SLF",
    "SIM",
    "SLOT",
    "TC",
    "TID",
    "TD",
    "ARG",
    "PTH",
    "ERA",
    "PD",
    "PGH",
    "PL",
    "TRY",
    "NPY",
    "RUF",
    "D100",
    "D101",
    "D102",
    "D103",
    "D104",
    "D105",
    "D106",
    "D107",
]
fixable = [ "ALL" ]
unfixable = [  ]
ignore = [
    # Formatter conflicts
    "COM812", # Trailing comma missing (conflicts with formatter)
    "ISC001", # Implicitly concatenated string literals (conflicts with formatter)

    # CLI script patterns - these are appropriate design choices for command-line tools
    # "PLR0912" - Re-enabled: Too many branches - now enforced to maintain code quality
    # "PLR0913" - Re-enabled: Too many arguments - catch constructor complexity issues
    # "PLR0915" - Re-enabled: Too many statements - now enforced after refactoring complex methods
    "PLR2004", # Magic value used in comparison - acceptable for CLI constants and thresholds
    "FBT001", # Boolean-typed positional argument - appropriate for CLI flag arguments
    "FBT002", # Boolean default positional argument - standard CLI pattern
    "BLE001", # Do not catch blind exception - intentional defensive programming for CLI robustness
    # "S603" - Re-enabled: subprocess call: check for execution of untrusted input - now using secure subprocess wrappers
    # "S607" - Re-enabled: Starting a process with a partial executable path - now using full paths
    "T201", # print found - appropriate for CLI output and user feedback
    "TRY300", # Consider moving statement to else block - acceptable control flow for CLI scripts
    "TRY301", # Abstract raise to inner function - acceptable for straightforward CLI error handling
    "ARG001", # Unused function argument - common in signal handlers and callback functions
    "ERA001", # Found commented-out code - acceptable for explanatory comments in CLI tools
    "EXE001", # Shebang is present but file is not executable - handled by packaging/deployment
    # "S110" - Re-enabled: try-except-pass detected - now enforced to improve error handling
    "PTH123", # open() should be replaced by Path.open() - acceptable for system file access
    "N806", # Variable in function should be lowercase - acceptable for constants and ANSI color codes
    "F841", # Local variable assigned but never used - acceptable for color constants in CLI scripts
    "EM102", # Exception must not use f-string - acceptable for dynamic error messages in CLI tools
    "TRY003", # Avoid specifying long messages outside exception class - acceptable for CLI error reporting
    "PLW2901", # for loop variable overwritten - acceptable for line processing in CLI scripts
]

[tool.ruff.lint.per-file-ignores]
# Test names and class groupings already document behavior; avoid requiring
# docstrings for each pytest case while still checking production scripts.
"**/tests/test_*.py" = [ "S101", "SLF001", "D101", "D102", "D103" ]

# Import sorting and organization configuration
[tool.ruff.lint.isort]
known-first-party = [
    "archive_changelog",
    "benchmark_utils",
    "compare_storage_backends",
    "hardware_utils",
    "postprocess_changelog",
    "subprocess_utils",
    "tag_release",
]
force-single-line = false
split-on-trailing-comma = true
combine-as-imports = true
order-by-type = true
section-order = [
    "future",
    "standard-library",
    "third-party",
    "first-party",
    "local-folder",
]
# Organize imports: standard library, third-party, first-party, local

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

# Pylint configuration removed - now using ruff exclusively for Python linting
# Ruff provides faster, more comprehensive linting with better maintenance

[tool.pytest.ini_options]
minversion = "8.0"
addopts = [ "-ra", "--strict-markers", "--strict-config", "--color=yes" ]
testpaths = [ "scripts/tests" ]
python_files = [ "test_*.py", "*_test.py" ]
python_classes = [ "Test*" ]
python_functions = [ "test_*" ]

[dependency-groups]
dev = [ "pytest>=9.0.3", "ruff>=0.12.11", "semgrep>=1.152.0", "ty>=0.0.8" ]
