Skip to content

Commit

Permalink
Implement automatic version metadata sync
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mattsta committed Jul 21, 2024
1 parent f84d731 commit 9806c29
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ib_async/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"""Version info."""

__version_info__ = (1, 0, 0)
__version__ = ".".join(str(v) for v in __version_info__)
from importlib.metadata import version

__version__ = version("ib_async")

# historically, ib_insync has provided __version_info__ as a 3-tuple of integers,
# so we shouldn't use non-integer version components like "1.3b1" etc or else
# anybody consuming __version_info__ may receive values outside of ranges they expect.
__version_info__ = tuple([int(x) for x in __version__.split(".")])

0 comments on commit 9806c29

Please sign in to comment.