#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Note: To use the 'upload' functionality of this file, you must:
#   $ pipenv install twine --dev

import io
import os
import sys
from shutil import rmtree

from setuptools import find_packages, setup, Command

# Package meta-data.
NAME = 'LittleSnowFox'
DESCRIPTION = """KAILINss - TOGGLE(KAILIN): Single Cell Fate Tracing tools"""
URL = 'https://github.com/FullBlackWolf/KAILINss'
EMAIL = 'drchenjunpeng@hotmail.com'
AUTHOR = 'Junpeng Chen(Donald Louis)'
REQUIRES_PYTHON = ">=3.9, <3.10"
VERSION = '0.2.3.3'

# What packages are required for this module to be executed?
REQUIRED = [
    'anndata==0.10.6',
    'anyio==4.3.0',
    'argon2-cffi==23.1.0',
    'argon2-cffi-bindings==21.2.0',
    'array_api_compat==1.4.1',
    'arrow==1.3.0',
    'asttokens==2.4.1',
    'async-lru==2.0.4',
    'attrs==23.2.0',
    'Babel==2.14.0',
    'backports.tarfile==1.2.0',
    'beautifulsoup4==4.12.3',
    'bleach==6.1.0',
    'certifi==2024.2.2',
    'cffi==1.16.0',
    'charset-normalizer==3.3.2',
    'colorama==0.4.6',
    'comm==0.2.2',
    'contourpy==1.2.0',
    'cospar==0.3.3',
    'cycler==0.12.1',
    'debugpy==1.8.1',
    'decorator==5.1.1',
    'defusedxml==0.7.1',
    'docutils==0.21.2',
    'et_xmlfile==2.0.0',
    'ete3==3.1.3',
    'exceptiongroup==1.2.0',
    'executing==2.0.1',
    'fastcluster==1.2.6',
    'fastjsonschema==2.19.1',
    'fonttools==4.49.0',
    'fqdn==1.5.1',
    'frozendict==2.4.4',
    'get-annotations==0.1.2',
    'gseapy==1.1.2',
    'h11==0.14.0',
    'h5py==3.10.0',
    'html5lib==1.1',
    'httpcore==1.0.4',
    'httpx==0.27.0',
    'idna==3.6',
    'igraph==0.11.4',
    'importlib-metadata==6.8.0',
    'importlib_resources==6.3.0',
    'ipykernel==6.29.3',
    'ipython==8.18.1',
    'ipywidgets==8.1.2',
    'isoduration==20.11.0',
    'jaraco.classes==3.4.0',
    'jaraco.context==5.3.0',
    'jaraco.functools==4.0.1',
    'jedi==0.19.1',
    'Jinja2==3.1.3',
    'joblib==1.3.2',
    'json5==0.9.22',
    'jsonpointer==2.4',
    'jsonschema==4.21.1',
    'jsonschema-specifications==2023.12.1',
    'jupyter==1.0.0',
    'jupyter_client==8.6.1',
    'jupyter-console==6.6.3',
    'jupyter_core==5.7.2',
    'jupyter-events==0.9.1',
    'jupyter-lsp==2.2.4',
    'jupyter_server==2.13.0',
    'jupyter_server_terminals==0.5.3',
    'jupyterlab==4.1.4',
    'jupyterlab_pygments==0.3.0',
    'jupyterlab_server==2.25.4',
    'jupyterlab_widgets==3.0.10',
    'keyring==25.2.1',
    'kiwisolver==1.4.5',
    'lab==8.1',
    'leidenalg==0.10.2',
    'llvmlite==0.42.0',
    'lxml==5.2.2',
    'markdown-it-py==3.0.0',
    'MarkupSafe==2.1.5',
    'matplotlib==3.7.5',
    'matplotlib-inline==0.1.6',
    'mdurl==0.1.2',
    'mistune==3.0.1',
    'mizani==0.11.0',
    'more-itertools==10.2.0',
    'multitasking==0.0.11',
    'natsort==8.4.0',
    'nbclient==0.10.0',
    'nbconvert==7.8.0',
    'nbformat==5.10.2',
    'nest-asyncio==1.6.0',
    'networkx==3.2.1',
    'nh3==0.2.17',
    'notebook==7.1.1',
    'notebook_shim==0.2.4',
    'numba==0.59.0',
    'numpy==1.26.4',
    'openpyxl==3.1.5',
    'overrides==7.7.0',
    'packaging==24.0',
    'pandas==2.2.2',
    'pandocfilters==1.5.1',
    'parso==0.8.3',
    'patsy==0.5.6',
    'peewee==3.17.5',
    'pillow==10.2.0',
    'pip==24.2',
    'pkginfo==1.11.0',
    'platformdirs==4.2.0',
    'plotnine==0.13.1',
    'prometheus_client==0.20.0',
    'prompt-toolkit==3.0.43',
    'psutil==5.9.8',
    'pure-eval==0.2.2',
    'pycparser==2.21',
    'pygame==2.5.2',
    'Pygments==2.17.2',
    'pynndescent==0.5.11',
    'pyparsing==3.1.2',
    'python-dateutil==2.9.0.post0',
    'python-json-logger==2.0.7',
    'pytz==2024.1',
    #'pywin32==306',
    'pywin32-ctypes==0.2.2',
    'pywinpty==2.0.13',
    'PyYAML==6.0.1',
    'pyzmq==25.1.2',
    'qtconsole==5.5.1',
    'QtPy==2.4.1',
    'readme_renderer==43.0',
    'referencing==0.33.0',
    'requests==2.31.0',
    'requests-toolbelt==1.0.0',
    'rfc3339-validator==0.1.4',
    'rfc3986==2.0.0',
    'rfc3986-validator==0.1.1',
    'rich==13.7.1',
    'rpds-py==0.18.0',
    'scanpy==1.9.8',
    'scikit-learn==1.4.1.post1',
    'scikit-misc==0.3.1',
    'scipy==1.12.0',
    'seaborn==0.13.2',
    'Send2Trash==1.8.2',
    'session-info==1.0.0',
    'setuptools==68.2.2',
    'simplejson==3.19.2',
    'six==1.16.0',
    'sniffio==1.3.1',
    'soupsieve==2.5',
    'stack-data==0.6.3',
    'statsmodels==0.14.1',
    'stdlib-list==0.10.0',
    'terminado==0.18.1',
    'texttable==1.7.0',
    'threadpoolctl==3.3.0',
    'tinycss2==1.2.1',
    'tomli==2.0.1',
    'tornado==6.4',
    'tqdm==4.66.2',
    'traitlets==5.14.2',
    'twine==5.1.0',
    'txt2tags==3.9',
    'types-python-dateutil==2.8.19.20240311',
    'typing_extensions==4.10.0',
    'tzdata==2024.1',
    'umap-learn==0.5.5',
    'uri-template==1.3.0',
    'urllib3==2.2.1',
    'wcwidth==0.2.13',
    'webcolors==1.13',
    'webencodings==0.5.1',
    'websocket-client==1.7.0',
    'wheel==0.41.2',
    'widgetsnbextension==4.0.10',
    'yfinance==0.2.40',
    'zipp==3.18.0',
    'googledrivedownloader==0.4'
]


# What packages are optional?
EXTRAS = {
    # 'fancy feature': ['django'],
}

# The rest you shouldn't have to touch too much :)
# ------------------------------------------------
# Except, perhaps the License and Trove Classifiers!
# If you do change the License, remember to change the Trove Classifier for that!

import os
import io
from shutil import rmtree
import sys
from setuptools import Command

# Use relative path for current directory
try:
    with io.open('README.md', encoding='utf-8') as f:
        long_description = '\n' + f.read()
except FileNotFoundError:
    long_description = DESCRIPTION

# Load the package's __version__.py module as a dictionary.
about = {}
if not VERSION:
    project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
    with open(os.path.join(project_slug, '__version__.py')) as f:
        exec(f.read(), about)
else:
    about['__version__'] = VERSION


class UploadCommand(Command):
    """Support setup.py upload."""

    description = 'Build and publish the package.'
    user_options = []

    @staticmethod
    def status(s):
        """Prints things in bold."""
        print('\033[1m{0}\033[0m'.format(s))

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        try:
            self.status('Removing previous builds…')
            rmtree('dist')  # Changed to relative path
        except OSError:
            pass

        self.status('Building Source and Wheel (universal) distribution…')
        os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))

        self.status('Uploading the package to PyPI via Twine…')
        os.system('twine upload dist/*')

        self.status('Pushing git tags…')
        os.system('git tag v{0}'.format(about['__version__']))
        os.system('git push --tags')

        sys.exit()


# Where the magic happens:
setup(
    name=NAME,
    version=about['__version__'],
    description=DESCRIPTION,
    long_description=long_description,
    long_description_content_type='text/markdown',
    author=AUTHOR,
    author_email=EMAIL,
    python_requires=REQUIRES_PYTHON,
    url=URL,
    packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
    # If your package is a single module, use this instead of 'packages':
    # py_modules=['mypackage'], 

    # entry_points={
    #     'console_scripts': ['mycli=mymodule:cli'],
    # },
    install_requires=REQUIRED,
    extras_require=EXTRAS,
    include_package_data=True,
    license='MIT',
    classifiers=[
        # Trove classifiers
        # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.9',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy'
    ],
    # package_data={
    #     'kailin': ['*', '*/*', '*/*/*', '*/*/*/*'],  # Include all files and subdirectories
    # },
    # $ setup.py publish support.
    cmdclass={
        'upload': UploadCommand,
    },
)
