# Copyright 2023 Dmytro Yaroshenko (https://github.com/o-murphy)
# Copyright 2024 David Bookstaber (https://github.com/dbookstaber)

[build-system]
requires = [
    "setuptools",
    "setuptools-scm[toml]>=9.2",
    "setuptools_dynamic_dependencies",
    "tomli; python_version<'3.11'"
]
build-backend = "setuptools.build_meta"

[project]
name = "py_ballisticcalc"

authors = [
    { name = "o-murphy", email = "thehelixpg@gmail.com" },
    { name = "dbookstaber", email = "bookstaber@gmail.com" }
]
description = "LGPL library for small arms ballistic calculations (Python 3)"
readme = "README.md"
requires-python = ">=3.10"
keywords = ["py_ballisticcalc", "ballistics", "Cython", "ballistic calculator", "python", "ballistic solver"]
license = { file = "LICENSE" }
classifiers = [
    "Intended Audience :: Developers",
    "Natural Language :: English",
    "Programming Language :: Python",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "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",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: Implementation :: CPython",
]
dependencies = [
    "typing_extensions>= 4.12.2",
    "tomli>=2.2.1; python_version<'3.11'",
    "Deprecated>=1.2.18",
]

# NOTE:
#   version: will be calculated with setuptools-scm
#   optional-dependencies: will be calculated with before-build hook
dynamic = ["version", "optional-dependencies"]

[project.entry-points.py_ballisticcalc]
euler_engine = "py_ballisticcalc:EulerIntegrationEngine"
rk4_engine = "py_ballisticcalc:RK4IntegrationEngine"
scipy_engine = "py_ballisticcalc:SciPyIntegrationEngine"
verlet_engine = "py_ballisticcalc:VelocityVerletIntegrationEngine"

[project.urls]
"Homepage" = "https://github.com/o-murphy/py-ballisticcalc"
"Bug Reports" = "https://github.com/o-murphy/py-ballisticcalc/issues"
"Source" = "https://github.com/o-murphy/py-ballisticcalc"


[tool.setuptools.packages.find]
where = ["."]
include = ["py_ballisticcalc*"]

[tool.setuptools.package-data]
py_ballisticcalc = ["py.typed", "assets/*.toml"]


[project.scripts]
uconv = "py_ballisticcalc.tools.uconv:main"


[tool.pytest.ini_options]
minversion = "8.0"
addopts = "-rf"
testpaths = ["tests"]
markers = [
    "extended: rarely-modified logic",
    "engine: functionality that varies with engine",
    "stress: long-running or resource-intensive tests, opt-in only"
]

[tool.mypy]
packages = ["py_ballisticcalc"]

[tool.ruff]
include = [
    "pyproject.toml",
    "py_ballisticcalc/**/*.py",
    "py_ballisticcalc/**/*.pyi",
    "py_ballisticcalc.exts/**/*.py",
    "py_ballisticcalc.exts/**/*.pyi",
]
extend-exclude = [
    "__init__.py",
    "tests",
    "examples",
]
line-length = 120

[tool.ruff.lint]
ignore = ["F403", "F405"]

[tool.uv.sources]
"py_ballisticcalc.exts" = { path = "./py_ballisticcalc.exts" }  # required for `uv sync`

[tool.setuptools_scm]
root = "."  # required for valid .git repo root detect for main package in monorepo
fallback_version = "0.0.0.dev0"

# NOTE:
#   do not use [project.optional-dependencies]
#   we use setuptools_dynamic_dependencies as "before-build hook"
#   to guarantee strict tie of the `main` and the `exts` packages versions
[tool.setuptools_dynamic_dependencies.optional-dependencies]
exts = ["py_ballisticcalc.exts=={version}"]
charts = [
    "matplotlib>=3.10.7",
    "pillow>=11.3.0; python_version>='3.13' and sys_platform == 'win32'", # minimal wheel required for matplotlib with python 3.13+ in windows
    "pandas>=2.3.3",
    "numpy>=2.2.6",
    "numpy>=2.3.4; python_version>='3.14'",
    "scipy>=1.15.3",
]
scipy = [
    "numpy>=2.2.6",
    "numpy>=2.3.4; python_version>='3.14'",
    "scipy>=1.15.3",
]
dev = [
    "Cython>=3.1.4",
    "build>=1.3.0",

    # math and data
    "matplotlib>=3.10.7",
    "pillow>=11.3.0; python_version>='3.13' and sys_platform == 'win32'", # minimal wheel required for matplotlib with python 3.13+ in windows
    "pandas>=2.3.3",
    "numpy>=2.2.6",
    "numpy>=2.3.4; python_version>='3.14'",
    "scipy>=1.15.3",

    # "jupyter>=1.1.1"
    "ipykernel",
    "nbformat", # minimal installation for .ipynb for IDE (works in VS Code, PyCharm)

    # code standards
    "mypy>=1.18.2",
    "pylint>=4.0.1",
    "pytest>=8.4.2",
    "pytest-cov>=7.0.0",
    "pytest-xdist>=3.8.0",
    "ruff>=0.14.0",
    "cython-lint>=0.18.1",
    "pre-commit>=4.5.0",
    
    # stubs
    "scipy-stubs>=1.16.2.3; python_version>='3.11'",
    "types-deprecated>=1.2.15.20250304",
    "pandas-stubs>=2.3.2.250926",
]
docs = [
    "mkdocs-mermaid2-plugin>=1.2.2",
    "mkdocs>=1.6.1",
    "mkdocs-exclude>=1.0.2",
    "mkdocs-material[imaging]>=9.6.22",
    "mkdocs-redirects>=1.2.2",
    "mkdocstrings>=0.29.0",
    "mkdocstrings-python>=1.17.0",
    "mkdocs-autorefs>=1.4.2",
    "mike>=2.1.3",
    "pydocstyle>=6.3.0",
    "setuptools-scm>=9.2"
]

[dependency-groups]
# Duplication of "dev" group here is required to support `uv sync --dev`
# Previous declaration sufficient if we standardize on `uv pip install -e .[dev]`
dev = [
    "Cython>=3.1.4",
    "build>=1.3.0",

    # math and data
    "matplotlib>=3.10.7",
    "pillow>=11.3.0; python_version>='3.13' and sys_platform == 'win32'", # minimal wheel required for matplotlib with python 3.13+ in windows
    "pandas>=2.3.3",
    "numpy>=2.2.6",
    "numpy>=2.3.4; python_version>='3.14'",
    "scipy>=1.15.3",

    # "jupyter>=1.1.1"
    "ipykernel",
    "nbformat", # minimal installation for .ipynb for IDE (works in VS Code, PyCharm)

    # code standards
    "mypy>=1.18.2",
    "pylint>=4.0.1",
    "pytest>=8.4.2",
    "pytest-cov>=7.0.0",
    "pytest-xdist>=3.8.0",
    "ruff>=0.14.0",
    "cython-lint>=0.18.1",
    "pre-commit>=4.5.0",

    # stubs
    "scipy-stubs>=1.16.2.3; python_version>='3.11'",
    "types-deprecated>=1.2.15.20250304",
    "pandas-stubs>=2.3.2.250926",
]
test = [
    "pytest>=8.4.2",
    "pytest-cov>=7.0.0",
    "pytest-xdist>=3.8.0", 
]
