Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (69 sloc) 2.21 KB
import os
import re
import subprocess
import sys
from setuptools import setup
def get_version(package: str) -> str:
path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), package, "__init__.py"
)
with open(path, "r") as file:
source = file.read()
m = re.search(r'__version__ = ["\'](.+)["\']', source)
if m:
return m.group(1)
else:
return "0.0.0"
def get_packages(package):
"""Return root package and all sub-packages."""
return [
dirpath
for dirpath, dirnames, filenames in os.walk(package)
if os.path.exists(os.path.join(dirpath, "__init__.py"))
]
def check():
def run(command):
assert subprocess.run(command.split()).returncode == 0
print(f"'{command}' --- OK")
run("pycodestyle ivory")
run("pyflakes ivory")
run("mypy ivory")
run("pycodestyle tests")
run("pyflakes tests")
def publish():
check()
subprocess.run("python setup.py sdist bdist_wheel".split())
subprocess.run("twine upload dist/*".split())
version = get_version("ivory")
subprocess.run(["git", "tag", "-a", f"v{version}", "-m", f"'Version {version}'"])
subprocess.run(["git", "push", "origin", "--tags"])
sys.exit(0)
if sys.argv[-1] == "publish":
publish()
if sys.argv[-1] == "check":
check()
long_description = "Deep learning from scratch."
setup(
name="ivory",
version=get_version("ivory"),
description="Deep learning from scratch",
long_description=long_description,
url="https://ivory.daizutabi.net",
author="daizutabi",
author_email="daizutabi@gmail.com",
license="MIT",
packages=get_packages("ivory"),
include_package_data=True,
install_requires=["click"],
setup_requires=["pytest-runner"],
tests_require=["pytest", "pytest-cov", "keras", "nnabla", "tensorflow", "pandas"],
entry_points={"console_scripts": ["ivory = ivory.main:cli"]},
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
)
You can’t perform that action at this time.