From c6e75be31f21c1a2bde2ad688efc6c1681999c43 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Sun, 8 Feb 2026 00:00:57 -0300 Subject: [PATCH] Use importlib.metadata.version() for __version__ Replace hardcoded __VERSION__ = "0.1.9" in client.py with importlib.metadata.version() sourced from pyproject.toml. This fixes version drift (pyproject.toml had 0.1.10) and establishes a single source of truth for the package version. Closes #29 --- leakix/__init__.py | 7 +++++-- leakix/client.py | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/leakix/__init__.py b/leakix/__init__.py index d3d128b..925f578 100644 --- a/leakix/__init__.py +++ b/leakix/__init__.py @@ -1,4 +1,5 @@ -from leakix.client import __VERSION__ as __VERSION__ +from importlib.metadata import version + from leakix.client import Client as Client from leakix.client import HostResult as HostResult from leakix.client import Scope as Scope @@ -68,8 +69,10 @@ SuccessResponse as SuccessResponse, ) +__version__ = version("leakix") + __all__ = [ - "__VERSION__", + "__version__", "Client", "HostResult", "Scope", diff --git a/leakix/client.py b/leakix/client.py index 4dc3547..18a4c43 100644 --- a/leakix/client.py +++ b/leakix/client.py @@ -1,5 +1,6 @@ import json from enum import Enum +from importlib.metadata import version import requests from l9format import l9format @@ -10,8 +11,6 @@ from leakix.query import EmptyQuery, Query from leakix.response import ErrorResponse, RateLimitResponse, SuccessResponse -__VERSION__ = "0.1.9" - class Scope(Enum): SERVICE = "service" @@ -38,7 +37,7 @@ def __init__( self.base_url = base_url if base_url else DEFAULT_URL self.headers = { "Accept": "application/json", - "User-agent": f"leakix-client-python/{__VERSION__}", + "User-agent": f"leakix-client-python/{version('leakix')}", } if api_key: self.headers["api-key"] = api_key