diff --git a/scrivid/__init__.py b/scrivid/__init__.py index 07f195a..16c9b17 100644 --- a/scrivid/__init__.py +++ b/scrivid/__init__.py @@ -3,12 +3,13 @@ create_image_reference, define_properties, FileReference, HideAdjustment, ImageFileReference, ImageReference, MoveAdjustment, Properties, ShowAdjustment, VisibilityStatus ) +from ._version import __version__, __version_tuple__ from ._video_crafting import compile_video from .metadata import Metadata __all__ = [ - "compile_video", "create_image_reference", "define_properties", "errors", "FileReference", "HideAdjustment", - "ImageFileReference", "ImageReference", "Metadata", "motion_tree", "MoveAdjustment", "Properties", "qualms", - "ShowAdjustment", "VisibilityStatus" + "__version__", "__version_tuple__", "compile_video", "create_image_reference", "define_properties", "errors", + "FileReference", "HideAdjustment", "ImageFileReference", "ImageReference", "Metadata", "motion_tree", + "MoveAdjustment", "Properties", "qualms", "ShowAdjustment", "VisibilityStatus" ] diff --git a/scrivid/_version.py b/scrivid/_version.py new file mode 100644 index 0000000..35c0deb --- /dev/null +++ b/scrivid/_version.py @@ -0,0 +1,2 @@ +__version__ = "0.2.0" +__version_tuple__ = (0, 2, 0) diff --git a/setup.cfg b/setup.cfg index 4cd8ae1..eb6d350 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,9 @@ [metadata] name = scrivid -version = 0.2.0 +version = attr: scrivid._version.__version__ # Instantiating it as +# `scrivid.__version__` results in so many shaky imports from the root-level +# `__init__.py`, that it's just easier to get directly, even though it's +# "protected". description = A Python library to create instructions for a generated video. author = Trystyn Coté license = MIT diff --git a/tests/test_package.py b/tests/test_package.py new file mode 100644 index 0000000..52d915f --- /dev/null +++ b/tests/test_package.py @@ -0,0 +1,23 @@ +import scrivid + +import importlib.metadata + +import pytest + + +def convert_package_version_to_tuple(package_version): + return tuple(int(element) for element in package_version.split(".")) + + +@pytest.fixture +def package_version(): + yield importlib.metadata.version("scrivid") + + +def test_package_version(package_version): + assert scrivid.__version__ == package_version + + +def test_package_version_tuple(package_version): + package_version = convert_package_version_to_tuple(package_version) + assert scrivid.__version_tuple__ == package_version