From 76d43b314159d4869d369178da3dbb2ed9386bb4 Mon Sep 17 00:00:00 2001 From: Kadir Can Ozden <101993364+bysiber@users.noreply.github.com> Date: Sun, 22 Feb 2026 00:26:16 +0300 Subject: [PATCH] Add __version__ attribute to boltons package Uses importlib.metadata to read the version from the installed package metadata, falling back to "unknown" when running from a source checkout without installing. This allows users to do: import boltons print(boltons.__version__) --- boltons/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boltons/__init__.py b/boltons/__init__.py index e69de29b..e49cc319 100644 --- a/boltons/__init__.py +++ b/boltons/__init__.py @@ -0,0 +1,7 @@ +from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version("boltons") +except PackageNotFoundError: + # Package is not installed (e.g. running from source checkout) + __version__ = "unknown"