#!/usr/bin/env python3
"""Setup script for AITop."""

from pathlib import Path
from setuptools import find_packages, setup


def _read_version() -> str:
    """Load package version from aitop/version.py without importing package."""
    version_ns = {}
    version_file = Path(__file__).parent / "aitop" / "version.py"
    exec(version_file.read_text(encoding="utf-8"), version_ns)
    return str(version_ns["__version__"])


# Read README.md for long description
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

setup(
    name="aitop",
    version=_read_version(),
    description="A system monitor focused on AI/ML workload monitoring",
    long_description=long_description,
    long_description_content_type="text/markdown",
    author="Alexander Warth",
    author_email="alexander.warth@mailbox.org",
    url="https://gitlab.com/CochainComplex/aitop",
    project_urls={
        "Homepage": "https://gitlab.com/CochainComplex/aitop",
        "Source": "https://gitlab.com/CochainComplex/aitop",
        "Bug Tracker": "https://gitlab.com/CochainComplex/aitop/-/issues",
        "Author Website": "https://warth.ai",
    },
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        "psutil>=5.9.0,<6.0.0",  # System monitoring (CPU, memory, processes, signals)
    ],
    extras_require={
        "dev": [
            "black>=23.0.0,<24.0.0",
            "mypy>=1.0.0,<2.0.0",
            "pytest>=7.0.0,<8.0.0",
            "pytest-cov>=7.0.0,<8.0.0",
            "pylint>=2.17.0,<3.0.0",
            "isort>=5.12.0,<6.0.0",
            "flake8>=6.1.0,<7.0.0",
            "pre-commit>=3.3.0,<4.0.0",
            "types-psutil>=5.9.0,<8.0.0",  # Type stubs for psutil
        ],
        "docs": [
            "sphinx>=7.0.0,<8.0.0",
            "sphinx-rtd-theme>=1.3.0,<2.0.0",
        ],
    },
    entry_points={
        "console_scripts": [
            "aitop=aitop.__main__:main",
        ],
    },
    package_data={
        "aitop": ["config/*.json"],
    },
    python_requires=">=3.9",
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Console :: Curses",
        "Intended Audience :: Developers",
        "Intended Audience :: System Administrators",
        "License :: OSI Approved :: MIT License",
        "Operating System :: POSIX :: Linux",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "Topic :: System :: Monitoring",
    ],
)
