-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
68 lines (58 loc) · 2.19 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
"""
Dimcli package instructions for setuptools
https://setuptools.pypa.io/en/latest/setuptools.html
"""
from setuptools import setup, find_packages
from os import path
# To use a consistent encoding
from codecs import open
HERE = path.abspath(path.dirname(__file__))
# trick to manage package versions in one place only
# http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
import re
VERSIONFILE = "dimcli/VERSION.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
VERSIONSTRING = mo.group(1)
else:
raise RuntimeError(
"Unable to find version string in %s." % (VERSIONFILE, ))
# Get the long description from the README file
with open(path.join(HERE, "README.md"), encoding="utf-8") as f:
long_description = f.read()
# fix broken animation on pypi
long_description = long_description.replace("https://raw.githubusercontent.com/digital-science/dimcli/master/static/dimcli_animated.gif", "http://api-sample-data.dimensions.ai/videos/dimcli_animated.gif")
# Parse requirements.txt file so to have one single source of truth
REQUIREMENTS_DATA = []
with open(path.join(HERE, "requirements.txt"), encoding="utf-8") as f:
for l in f.readlines():
if not l.startswith("#"):
if ">=" in l:
REQUIREMENTS_DATA.append([l.split(">=")[0]])
elif "=" in l:
REQUIREMENTS_DATA.append([l.split("=")[0]])
setup(
name="dimcli",
version=VERSIONSTRING,
description="Python REPL/API for accessing dimensions.ai.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/digital-science/dimcli",
author="Michele Pasin @lambdaman",
author_email="[email protected]",
license="MIT License",
packages=find_packages(),
include_package_data=True,
package_data = {
'static': ['dimcli_animated.gif'],
'dimcli': ['templates/*.*'],
},
install_requires=REQUIREMENTS_DATA,
entry_points="""
[console_scripts]
dimcli = dimcli.main_cli:main_cli
dimcli_quicktest = dimcli.tests.quicktest:main
""",
)