import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from setuptools import find_packages, setup
from msprof_analyze.prof_common.path_manager import PathManager
from msprof_analyze.prof_common.file_manager import FileManager
from msprof_analyze.prof_common.utils import SafeConfigReader
sections = {
'URL': ['msprof_analyze_url'],
'EMAIL': ['ms_email']
}
requires = FileManager.read_common_file('requirements/build.txt').splitlines()
tests_requires = FileManager.read_common_file('requirements/tests.txt').splitlines()
tests_requires.extend(set(requires))
version = os.getenv("WHL_VERSION", FileManager.read_common_file('version.txt').strip())
CONFIG_FILE_PATH = "config/config.ini"
PathManager.check_input_file_path(CONFIG_FILE_PATH)
PathManager.check_file_size(CONFIG_FILE_PATH)
reader = SafeConfigReader(CONFIG_FILE_PATH)
reader.validate(sections)
config = reader.get_config()
try:
url = config.get("URL", "msprof_analyze_url")
except Exception as e:
raise RuntimeError("The configuration file is incomplete and not configured msprof_analyze_url information.") from e
try:
author_email = config.get("EMAIL", "ms_email")
except Exception as e:
raise RuntimeError("The configuration file is incomplete and not configured ms_email information.") from e
setup(
name="msprof-analyze",
version=version,
description="MindStudio Profiler Analyze Tools",
long_description="msprof-analyze provides statistics, analysis, and related tuning suggestions for the "
"performance data collected in training and large model scenarios. The main functional modules"
" include: performance comparison, performance analysis, and cluster analysis.",
url=url,
author="MindStudio",
author_email=author_email,
packages=find_packages(include=["msprof_analyze*"], exclude=["test*", "misc*"]),
include_package_data=True,
python_requires='>=3.7',
install_requires=requires,
extras_require={"test": tests_requires},
license='Apache License 2.0',
entry_points="""
[console_scripts]
msprof-analyze=msprof_analyze.cli.entrance:msprof_analyze_cli
"""
)