forked from deephaven-examples/deephaven-ib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
87 lines (69 loc) · 2.81 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
import os
import re
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
dh_ib_version = os.getenv("DH_IB_VERSION")
if not dh_ib_version:
raise Exception("deephaven-ib version must be set via the DH_IB_VERSION environment variable.")
dh_version = os.getenv("DH_VERSION")
if not dh_version:
raise Exception("deephaven version must be set via the DH_VERSION environment variable.")
ib_version = os.getenv("IB_VERSION")
if not ib_version:
raise Exception("ibapi version must be set via the IB_VERSION environment variable.")
def version_assert_format(version: str) -> None:
"""Assert that a version string is formatted correctly.
Args:
version: The version string to check.
Raises:
ValueError: If the version string is not formatted correctly.
"""
if not version:
raise ValueError("Version string is empty.")
# check if the version string is in semver format
# check if the version string is in semver format
pattern1 = re.compile(r"^([0-9]\d*)\.([0-9]\d*)\.([0-9]\d*)$")
pattern2 = re.compile(r"^([0-9]\d*)\.([0-9]\d*)\.([0-9]\d*)\.dev([0-9]\d*)$")
is_semver = bool(pattern1.match(version)) or bool(pattern2.match(version))
if not is_semver:
raise ValueError(f"Version string is not in semver format: {version}")
version_assert_format(dh_ib_version)
version_assert_format(dh_version)
version_assert_format(ib_version)
setuptools.setup(
name="deephaven_ib",
version=dh_ib_version,
author="David R. (Chip) Kent IV",
author_email="[email protected]",
description="An Interactive Brokers integration for Deephaven",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/deephaven-examples/deephaven-ib",
project_urls={
"Deephaven": "https://deephaven.io",
"Deephaven GitHub": "https://github.com/deephaven/deephaven-core",
"GitHub Issues": "https://github.com/deephaven-examples/deephaven-ib/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Financial and Insurance Industry",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Office/Business :: Financial :: Investment",
"Topic :: Software Development :: Libraries :: Python Modules",
],
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
python_requires=">=3.10",
install_requires=[
f"deephaven-server~={dh_version}",
"pandas",
f"ibapi=={ib_version}",
"lxml",
"ratelimit",
],
)