-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
113 lines (102 loc) · 3.5 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
import os
import subprocess
from typing import Any, Dict
import setuptools
version_info_path = os.path.join("macrobond_data_api", "__version__.py")
AUTHOR = "Macrobond Financial"
AUTHOR_EMAIL = "[email protected]"
DESCRIPTION = "Exposes a common API in Python for the Macrobond Web and Client Data APIs"
LICENSE = "MIT License"
URL = "https://github.com/macrobond/macrobond-data-api"
with open("README.md", "r", encoding="utf-8") as fh:
LONG_DESCRIPTION = fh.read()
try:
version = (
subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE, check=True).stdout.decode("utf-8").strip()
)
if version[0].lower() == "v":
version = version[1:]
print("version is from git tag")
except subprocess.CalledProcessError:
if os.path.exists(version_info_path):
with open(version_info_path, "r", encoding="utf-8") as f:
about: Dict[str, Any] = {}
exec(f.read(), about) # pylint: disable=exec-used
version = about["__version__"]
print("version is from " + version_info_path)
else:
version = "0.0.0" # pylint: disable=invalid-name
print("version is default")
if "-" in version:
v, i, s = version.split("-")
version = v + "+" + i + ".git." + s
print("version: " + version)
assert "-" not in version
assert "." in version
# fmt: off
PACKAGE_INFO = '''
__version__ = "''' + version + '''"
__author__ = "''' + AUTHOR + '''"
__author_email__ = "''' + AUTHOR_EMAIL + '''"
__description__ = "''' + DESCRIPTION + '''"
__license__ = "''' + LICENSE + '''"
__url__ = "''' + URL + '''"
'''
# fmt: on
with open(version_info_path, "w+", encoding="utf-8") as fh:
fh.write(PACKAGE_INFO)
setuptools.setup(
name="macrobond-data-api",
packages=setuptools.find_packages(include=["macrobond_data_api", "macrobond_data_api.*"]),
version=version,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
url=URL,
# TODO @mb-jp add keywords
# keywords="sample, example, setuptools",
# https://pypi.org/classifiers/
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
],
python_requires=">=3.9",
install_requires=[
"keyring>=24.3.0",
"requests>=2.32.3",
"ijson>=3.3.0",
"pywin32>=306; os_name=='nt'",
],
extras_require={
"extra": ["matplotlib", "statsmodels", "scikit-learn", "pandas"],
"dev": [
"mypy==1.13.0",
"pylint==3.3.2",
"pycodestyle==2.12.1",
"pdoc3==0.10.0",
"build==1.2.2",
"pytest==8.3.4",
"pytest-xdist==3.6.1",
"coverage==7.6.8",
"black[jupyter]==24.10.0",
"requests[socks]>=2.32.3",
"nbconvert==7.16.4",
"ipython>=7.34.0",
"types-pywin32==308.0.0.20241128",
"types-requests==2.32.0.20241016",
"types-setuptools==75.6.0.20241126",
"filelock==3.16.1",
"numpy>=1.24.4",
],
"socks": ["requests[socks]>=2.32.3"],
},
project_urls={
"Documentation": "https://macrobond.github.io/macrobond-data-api",
"Source": "https://github.com/macrobond/macrobond-data-api",
"Tracker": "https://github.com/macrobond/macrobond-data-api/issues",
},
)