Use setup.cfg for packaging

This commit is contained in:
c-bata
2021-03-11 16:32:15 +09:00
parent 0f11cdb8d0
commit 458ac42e9d
3 changed files with 54 additions and 54 deletions
+1 -1
View File
@@ -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/*
+50
View File
@@ -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
+3 -53
View File
@@ -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()