Skip to content

Commit 9806c29

Browse files
committed
Implement automatic version metadata sync
This version value has historically been manually updated, but modern python versions include a version library to read the version of the library you are currently running, so the library itself can read its own package version and provide it to users here. Primary difference here is instead of manual version in tuple with auto-string generation, now we use the package string then auto-generate the tuple-of-integers version from the string version. Fixes #47
1 parent f84d731 commit 9806c29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ib_async/version.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
"""Version info."""
22

3-
__version_info__ = (1, 0, 0)
4-
__version__ = ".".join(str(v) for v in __version_info__)
3+
from importlib.metadata import version
4+
5+
__version__ = version("ib_async")
6+
7+
# historically, ib_insync has provided __version_info__ as a 3-tuple of integers,
8+
# so we shouldn't use non-integer version components like "1.3b1" etc or else
9+
# anybody consuming __version_info__ may receive values outside of ranges they expect.
10+
__version_info__ = tuple([int(x) for x in __version__.split(".")])

0 commit comments

Comments
 (0)