forked from mead-ml/mead-baseline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_xpctl.py
85 lines (78 loc) · 2.63 KB
/
setup_xpctl.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
import os
import re
import shutil
from setuptools import setup
from xpctl import __version__
class About(object):
NAME = 'xpctl'
AUTHOR = 'dpressel'
VERSION = __version__
EMAIL = "{}@gmail.com".format(AUTHOR)
BASE_URL = "https://www.github.com/{}/baseline/tree/master".format(AUTHOR)
URL = "{}/python/{}".format(BASE_URL, NAME)
DOC_NAME = "docs/{}.md".format(NAME)
DOC_URL = "{}/docs/".format(BASE_URL)
def fix_links(text):
"""Pypi doesn't seem to host multiple docs so replace local links with ones to github."""
regex = re.compile(r"\[(.*?)\]\((.*?\.md)\)")
text = regex.sub(r"[\1]({}\2)".format(About.DOC_URL), text)
return text
def read_doc(f_name, new_name=None, fix_fn=fix_links):
"""
Because our readme is outside of this dir we need to copy it in so
that it is picked up by the install.
"""
if new_name is None:
new_name = f_name
path = os.path.dirname(os.path.realpath(__file__))
doc_loc = os.path.normpath(os.path.join(path, '..', f_name))
new_loc = os.path.join(path, new_name)
if os.path.isfile(doc_loc):
shutil.copyfile(doc_loc, new_loc)
descript = open(new_loc, 'r').read()
return fix_fn(descript)
def main():
setup(
name=About.NAME,
version=About.VERSION,
description='Experiment Control and Tracking',
long_description=read_doc(About.DOC_NAME, "README.md"),
long_description_content_type="text/markdown",
author=About.AUTHOR,
author_email=About.EMAIL,
license='Apache 2.0',
url=About.URL,
packages=['xpctl'],
install_requires=[
'Click',
'click-shell',
'pymongo',
'pandas',
'xlsxwriter',
'jsondiff',
],
entry_points={
'console_scripts': [
'xpctl = xpctl.cli:cli'
],
},
extras_require={
'test': []
},
classifiers={
'Development Status :: 2 - Pre-Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
},
keywords=['experiment control', 'tracking'],
)
if __name__ == "__main__":
main()