From 1662d73d36ac64215322cac8673a907a23217d07 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Fri, 3 Jul 2026 16:59:06 -0400 Subject: [PATCH] refactor: derive __version__ from package metadata (single source) Signed-off-by: disqualifier --- src/aiowebhooks/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aiowebhooks/__init__.py b/src/aiowebhooks/__init__.py index 58a05ab..712e241 100644 --- a/src/aiowebhooks/__init__.py +++ b/src/aiowebhooks/__init__.py @@ -5,10 +5,15 @@ WebhookResult and never raises on a send failure. see README for usage. the [discord] extra adds DiscordWebhook (aiowebhooks.discord). """ +from importlib.metadata import PackageNotFoundError, version + from .errors import NoUrlsError, WebhookError from .result import WebhookResult from .sender import Webhook __all__ = ["Webhook", "WebhookResult", "WebhookError", "NoUrlsError"] -__version__ = "0.1.8" +try: + __version__ = version("aiowebhooks") +except PackageNotFoundError: + __version__ = "0.0.0+unknown"