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

[project]
name = "pychnosz"
version = "1.1.10"
description = "Python port of the package CHNOSZ"
readme = "README.md"
license = {text = "MIT License"}
authors = [
    {name = "Grayson Boyer", email = "gmboyer@asu.edu"},
]
maintainers = [
    {name = "Grayson Boyer", email = "gmboyer@asu.edu"},
]
keywords = [
    "thermodynamics",
    "geochemistry",
    "geobiochemistry", 
    "aqueous chemistry",
    "equilibrium",
    "phase diagrams"
]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Science/Research",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.8",
    "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",
    "Topic :: Scientific/Engineering :: Chemistry",
    "Topic :: Scientific/Engineering :: Physics"
]
requires-python = ">=3.10"
dependencies = [
    "numpy>=1.20.0",
    "pandas>=1.3.0",
    "scipy>=1.7.0",
    "matplotlib>=3.3.0"
]

[project.optional-dependencies]
dev = [
    "pytest>=6.0",
    "pytest-cov",
    "black",
    "flake8",
    "mypy",
    "pre-commit"
]
docs = [
    "sphinx>=4.0",
    "sphinx-rtd-theme",
    "sphinx-autodoc-typehints",
    "myst-parser"
]
interactive = [
    "plotly>=5.0.0",
    "ipython>=7.0.0"
]

[project.urls]
Homepage = "https://worm-portal.asu.edu"
Repository = "https://github.com/worm-portal/pychnosz"
Documentation = "https://worm-portal.asu.edu/pyCHNOSZ-docs/index.html"
Issues = "https://github.com/worm-portal/pychnosz/issues"

[tool.setuptools]
packages = ["pychnosz", "pychnosz.core", "pychnosz.models", "pychnosz.utils", "pychnosz.data", "pychnosz.geochemistry", "pychnosz.biomolecules", "pychnosz.fortran"]

[tool.setuptools.package-data]
"pychnosz.data" = ["*.csv", "*.csv.gz", "*.json", "extdata/**/*"]
# Fortran binaries are compiled during build, so we need to include them in the wheel
"pychnosz.fortran" = ["*.so", "*.dll", "*.dylib"]

[tool.black]
line-length = 88
target-version = ['py310']

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

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "--cov=pychnosz --cov-report=term-missing"

[tool.cibuildwheel]
# Build for Python 3.10, 3.11, 3.12, and 3.13
build = "cp310-* cp311-* cp312-* cp313-*"

# Skip 32-bit builds, PyPy, and musllinux (focus on manylinux)
skip = "*-win32 *-manylinux_i686 *-musllinux* pp*"

# Build for these platforms
# manylinux: Linux with glibc (x86_64, aarch64)
# musllinux: Linux with musl (x86_64, aarch64)
# macosx: macOS (x86_64, arm64 for Apple Silicon)
# win: Windows (amd64)
build-verbosity = 1

# Before building the wheel, compile the Fortran library
before-build = "python compile_fortran.py"

# Test the wheel after building
test-requires = "pytest numpy pandas scipy matplotlib"
test-command = "python {project}/test_integration.py"

# Platform-specific settings
[tool.cibuildwheel.linux]
# Use manylinux_2_28 (AlmaLinux 8, has dnf and better package support)
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
# gfortran installation is handled via CIBW_BEFORE_ALL_LINUX in GitHub Actions

[tool.cibuildwheel.macos]
# Architecture selection is handled in GitHub Actions workflow
# (x86_64 on macos-15-intel, arm64 on macos-latest)
# Homebrew gcc on macOS 15 requires 15.0 minimum for both Intel and ARM
environment = { MACOSX_DEPLOYMENT_TARGET = "15.0" }

[tool.cibuildwheel.windows]
# Only build for 64-bit Windows
archs = "AMD64"
# MinGW installation is handled via CIBW_BEFORE_ALL_WINDOWS in GitHub Actions