From eb35feb30914b544ea472ca43a7f8198d30abfb0 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Sat, 1 Apr 2023 15:45:48 -0400 Subject: [PATCH] Add __version__ (#103) Add __version__ to kor public interface --- kor/__init__.py | 2 ++ kor/version.py | 7 +++++++ tests/test_public_interface.py | 1 + 3 files changed, 10 insertions(+) create mode 100644 kor/version.py diff --git a/kor/__init__.py b/kor/__init__.py index 361be49..29f2734 100644 --- a/kor/__init__.py +++ b/kor/__init__.py @@ -7,6 +7,7 @@ TypeDescriptor, TypeScriptDescriptor, ) +from .version import __version__ __all__ = ( "BulletPointDescriptor", @@ -22,4 +23,5 @@ "TypeDescriptor", "TypeScriptDescriptor", "XMLEncoder", + "__version__", ) diff --git a/kor/version.py b/kor/version.py new file mode 100644 index 0000000..a1f50c3 --- /dev/null +++ b/kor/version.py @@ -0,0 +1,7 @@ +"""Get the version of the package.""" +from importlib import metadata + +try: + __version__ = metadata.version("kor") +except metadata.PackageNotFoundError: + __version__ = "local" diff --git a/tests/test_public_interface.py b/tests/test_public_interface.py index dc9d6a7..d75553c 100644 --- a/tests/test_public_interface.py +++ b/tests/test_public_interface.py @@ -19,6 +19,7 @@ def test_kor__all__() -> None: "TypeDescriptor", "TypeScriptDescriptor", "XMLEncoder", + "__version__", "create_extraction_chain", "from_pydantic", ]