From 03825bbad3eb28ff64e1a40270c99facdca48565 Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Mon, 5 Aug 2024 16:34:22 +0000 Subject: [PATCH] Make version dynamic --- src/instawebhooks/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/instawebhooks/__main__.py b/src/instawebhooks/__main__.py index 6a7cdee..2dc21e3 100644 --- a/src/instawebhooks/__main__.py +++ b/src/instawebhooks/__main__.py @@ -9,6 +9,7 @@ from datetime import datetime, timedelta from itertools import dropwhile, takewhile from time import sleep +import importlib.metadata try: from aiohttp import ClientSession @@ -41,6 +42,8 @@ def closure_check_regex(arg_value): return closure_check_regex +version = importlib.metadata.version("instawebhooks") + # Set up logging logger = logging.getLogger(__name__) logging.basicConfig( @@ -90,7 +93,7 @@ def closure_check_regex(arg_value): help="don't show the post embed and only send message content", action="store_true", ) -parser.add_argument("--version", action="version", version="%(prog)s 0.1.1") +parser.add_argument("--version", action="version", version="%(prog)s " + version) args = parser.parse_args() # Set the logger to debug if verbose is enabled