diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index d2d6686e..75a7c249 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools - pip install --progress-bar off .[release] + pip install --progress-bar off wheel twine - run: python setup.py sdist bdist_wheel - run: twine check dist/* diff --git a/setup.cfg b/setup.cfg index 8a6c2350..81f6acdd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,53 @@ +[metadata] +name = optuna-dashboard +version = attr: optuna_dashboard.version.__version__ + +url = https://github.com/optuna/optuna-dashboard +author = Masashi Shibata +author_email = m.shibata1020@gmail.com +description = Real-time dashboard for Optuna. +long_description = file: README.md +long_description_content_type = text/markdown +license = MIT License +classifiers = + Development Status :: 3 - Alpha + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3 :: Only + Intended Audience :: Science/Research + +[options] +python_requires = >=3.6 +include_package_data = True +packages = find: +install_requires = + optuna>=2.4 + bottle + typing-extensions; python_version<3.8 + +[options.extras_require] +lint = + black + mypy + flake8 + +[options.entry_points] +console_scripts = + optuna-dashboard = optuna_dashboard.cli:main + +[options.package_data] +optuna_dashboard = public/* + +[options.packages.find] +exclude = + tests + [flake8] max-line-length = 99 statistics = True diff --git a/setup.py b/setup.py index fd15faf2..6b40b52b 100644 --- a/setup.py +++ b/setup.py @@ -1,54 +1,4 @@ -import os -import sys -import types -from typing import List -from setuptools import setup, find_packages -from importlib.machinery import SourceFileLoader +from setuptools import setup -BASE_PATH = os.path.dirname(__file__) - - -def get_long_description() -> str: - readme_filepath = os.path.join(BASE_PATH, "README.md") - with open(readme_filepath) as f: - return f.read() - - -def get_version() -> int: - version_filepath = os.path.join(BASE_PATH, "optuna_dashboard", "version.py") - module_name = "version" - target_module = types.ModuleType(module_name) - loader = SourceFileLoader(module_name, version_filepath) - loader.exec_module(target_module) - return getattr(target_module, "__version__") - - -def get_install_requires() -> List[str]: - deps = ["optuna>=2.4", "bottle"] - if sys.version_info[:2] < (3, 8): - deps.append("typing-extensions") - return deps - - -setup( - name="optuna-dashboard", - version=get_version(), - description="Real-time dashboard for Optuna.", - long_description=get_long_description(), - long_description_content_type="text/markdown", - author="Masashi Shibata", - author_email="m.shibata1020@gmail.com", - url="https://github.com/optuna/optuna-dashboard", - packages=find_packages(), - install_requires=get_install_requires(), - extras_require={ - "lint": ["black", "flake8", "mypy"], - "release": ["wheel", "twine"], - }, - package_data={"optuna_dashboard": ["public/*"]}, - entry_points={ - "console_scripts": [ - "optuna-dashboard = optuna_dashboard.cli:main", - ], - }, -) +if __name__ == '__main__': + setup()