diff --git a/changelog.d/version-from-metadata.fixed.md b/changelog.d/version-from-metadata.fixed.md new file mode 100644 index 00000000..a9a36fd8 --- /dev/null +++ b/changelog.d/version-from-metadata.fixed.md @@ -0,0 +1 @@ +- Fixed `microimpute.__version__` reporting 1.1.2 while the package was at 3.1.1, by reading the version from installed package metadata. diff --git a/microimpute/__init__.py b/microimpute/__init__.py index 2667c7ef..14cf862e 100644 --- a/microimpute/__init__.py +++ b/microimpute/__init__.py @@ -19,7 +19,12 @@ - Visualization: performance and comparison plots """ -__version__ = "1.1.2" +try: # Python 3.8+ + from importlib.metadata import PackageNotFoundError, version as _version + + __version__ = _version("microimpute") +except PackageNotFoundError: # running from a source tree without an install + __version__ = "unknown" # Import automated imputation from microimpute.comparisons.autoimpute import AutoImputeResult, autoimpute