forked from TsumiNa/CVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
148 lines (123 loc) · 4.06 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright 2017 TsumiNa. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
from pathlib import Path
from setuptools import setup, find_packages
def requirements(filename="requirements.txt"):
"""
Return requirements list from a text file.
Parameters
----------
filename: str
Name of requirement file.
Returns
-------
str-list
"""
try:
require = list()
f = open(filename, "rb")
for line in f.read().decode("utf-8").split("\n"):
line = line.strip()
if "#" in line:
line = line[:line.find("#")].strip()
if line:
require.append(line)
except IOError:
print("'{}' not found!".format(filename))
require = list()
return require
if __name__ == "__main__":
# Your package name
PKG_NAME = 'cvm'
# Your GitHub user name
GITHUB_USERNAME = 'TsumiNa'
# Short description will be the description on PyPI
SHORT_DESCRIPTION = 'CVM is a python package for solution limit calculation using **Cluster Variation Method** (CVM).'
# Long description will be the body of content on PyPI page
with open('README.md') as f:
LONG_DESCRIPTION = f.read()
with open('LICENSE') as f:
LICENSE = f.read()
# Version number, VERY IMPORTANT!
VERSION = '0.3.0'
# Author and Maintainer
AUTHOR = 'TsumiNa'
# Author email
MAINTAINER = 'TsumiNa'
PACKAGES, INCLUDE_PACKAGE_DATA, PACKAGE_DATA, PY_MODULES = (
None,
None,
None,
None,
)
# It's a directory style package
if os.path.exists(__file__[:-8] + PKG_NAME):
# Include all sub packages in package directory
PACKAGES = find_packages(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests', 'docs'])
# Include everything in package directory
INCLUDE_PACKAGE_DATA = True
PACKAGE_DATA = {
"": ["*.*"],
}
# It's a single script style package
elif os.path.exists(__file__[:-8] + PKG_NAME + ".py"):
PY_MODULES = [
PKG_NAME,
]
# Project Url
GITHUB_URL = "https://github.com/{0}/{1}".format(GITHUB_USERNAME, PKG_NAME)
# Use todays date as GitHub release tag
RELEASE_TAG = 'v' + VERSION
# Source code download url
DOWNLOAD_URL = "https://github.com/{0}/{1}/archive/{2}.tar.gz".format(
GITHUB_USERNAME, PKG_NAME, RELEASE_TAG)
PLATFORMS = [
"Windows",
"MacOS",
"Unix",
]
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
]
# Read requirements.txt, ignore comments
INSTALL_REQUIRES = requirements()
SETUP_REQUIRES = ['pytest-runner', 'ruamel.yaml']
TESTS_REQUIRE = ['pytest']
setup(python_requires='~=3.6',
name=PKG_NAME,
description=SHORT_DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
packages=PACKAGES,
include_package_data=INCLUDE_PACKAGE_DATA,
package_data=PACKAGE_DATA,
py_modules=PY_MODULES,
url=GITHUB_URL,
download_url=DOWNLOAD_URL,
classifiers=CLASSIFIERS,
platforms=PLATFORMS,
license=LICENSE,
setup_requires=SETUP_REQUIRES,
install_requires=INSTALL_REQUIRES,
tests_require=TESTS_REQUIRE)
"""
Appendix
--------
classifiers: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"""