from setuptools import setup, find_packages
import os

def parse_requirements(filename):
    if not os.path.exists(filename):
        return []
    try:
        with open(filename, 'r', encoding='utf-8') as f:
            return [line.strip() for line in f if line.strip() and not line.startswith('#')]
    except UnicodeDecodeError:
        with open(filename, 'r', encoding='utf-16') as f:
            return [line.strip() for line in f if line.strip() and not line.startswith('#')]

setup(
    name="pageindex-mcts",
    version="0.1.0",
    description="MCTS based PageIndex search library",
    long_description=open("README.md", encoding='utf-8').read(),
    long_description_content_type="text/markdown",
    author="PageIndexMCTS Team",
    packages=find_packages(include=['search', 'search.*', 'pageindex_', 'pageindex_.*']),
    include_package_data=True,
    install_requires=parse_requirements('requirements.txt'),
    python_requires='>=3.8',
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)
