From 1ddf2a5202e065a5df18dfa58a88faa5784a3f8c Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 14 Mar 2025 22:51:17 +0800 Subject: chore: bump version to 0.2.2 and update version retrieval method in __init__.py --- Cargo.toml | 2 +- src/conventionalrp/__init__.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 982bd5d..efd1fb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "conventionalrp" -version = "0.2.1" +version = "0.2.2" edition = "2021" description = "HydroRoll Conventional Role Play SDK" license = "AGPLv3.0" diff --git a/src/conventionalrp/__init__.py b/src/conventionalrp/__init__.py index 83ed8ce..bad6a58 100644 --- a/src/conventionalrp/__init__.py +++ b/src/conventionalrp/__init__.py @@ -1,5 +1,16 @@ from . import _core -from packaging.version import Version +__all__ = ["_core", "__version__"] -__version__ = Version('0.2.1') +from importlib.metadata import version +from pkg_resources import get_distribution + +try: + # For Python 3.8+ + __version__ = version("conventionalrp") +except ImportError: + try: + # For Python < 3.8 + __version__ = get_distribution("conventionalrp").version + except Exception: + raise ImportError("Failed to get version") -- cgit v1.2.3-70-g09d2