|
| 1 | +import os |
| 2 | +import re |
| 3 | +from typing import Dict, List |
| 4 | + |
| 5 | +from setuptools import find_packages, setup |
| 6 | + |
| 7 | + |
| 8 | +def read_file(filename: str) -> str: |
| 9 | + with open(os.path.join(os.path.dirname(__file__), filename)) as f: |
| 10 | + return f.read().strip() |
| 11 | + |
| 12 | + |
| 13 | +def read_version() -> str: |
| 14 | + regexp = re.compile(r"^__VERSION__\W*=\W*'([\d.abrc]+)'") |
| 15 | + |
| 16 | + with open( |
| 17 | + os.path.join( |
| 18 | + os.path.dirname(__file__), 'pytorch_optimizer', '__init__.py' |
| 19 | + ) |
| 20 | + ) as f: |
| 21 | + for line in f: |
| 22 | + match = regexp.match(line) |
| 23 | + if match is not None: |
| 24 | + return match.group(1) |
| 25 | + |
| 26 | + raise RuntimeError('Cannot find version in pytorch_optimizer/__init__.py') |
| 27 | + |
| 28 | + |
| 29 | +INSTALL_REQUIRES: List[str] = ['torch>=1.5.0'] |
| 30 | + |
| 31 | + |
| 32 | +CLASSIFIERS: List[str] = [ |
| 33 | + 'License :: OSI Approved :: Apache Software License', |
| 34 | + 'Intended Audience :: Developers', |
| 35 | + 'Intended Audience :: Science/Research', |
| 36 | + 'Programming Language :: Python :: 3', |
| 37 | + 'Programming Language :: Python :: 3.6', |
| 38 | + 'Programming Language :: Python :: 3.7', |
| 39 | + 'Programming Language :: Python :: 3.8', |
| 40 | + 'Operating System :: OS Independent', |
| 41 | + 'Topic :: Scientific/Engineering :: Artificial Intelligence', |
| 42 | +] |
| 43 | + |
| 44 | +KEYWORDS: List[str] = sorted( |
| 45 | + [ |
| 46 | + 'pytorch-optimizer', |
| 47 | + 'pytorch', |
| 48 | + 'adamp', |
| 49 | + 'sgdp', |
| 50 | + 'ranger', |
| 51 | + 'ranger21', |
| 52 | + 'agc', |
| 53 | + 'gc', |
| 54 | + 'chebyshev_schedule', |
| 55 | + 'lookahead', |
| 56 | + 'radam', |
| 57 | + ] |
| 58 | +) |
| 59 | + |
| 60 | +PROJECT_URLS: Dict[str, str] = { |
| 61 | + 'Website': 'https://github.com/kozistr/pytorch_optimizer', |
| 62 | + 'Issues': 'https://github.com/kozistr/pytorch_optimizer/issues', |
| 63 | +} |
| 64 | + |
| 65 | +setup( |
| 66 | + name='pytorch-optimizer', |
| 67 | + version=read_version(), |
| 68 | + description='pytorch-optimizer', |
| 69 | + long_description=read_file('README.md'), |
| 70 | + long_description_content_type='text/markdown', |
| 71 | + classifiers=CLASSIFIERS, |
| 72 | + platforms=['Linux', 'Windows'], |
| 73 | + author='kozistr', |
| 74 | + |
| 75 | + url='https://github.com/kozistr/pytorch_optimizer', |
| 76 | + download_url='https://pypi.org/project/pytorch-optimizer/', |
| 77 | + license='Apache 2', |
| 78 | + packages=find_packages(), |
| 79 | + install_requires=INSTALL_REQUIRES, |
| 80 | + keywords=KEYWORDS, |
| 81 | + zip_safe=True, |
| 82 | + include_package_data=True, |
| 83 | + project_urls=PROJECT_URLS, |
| 84 | + python_requires='>=3.6.0', |
| 85 | +) |
0 commit comments