From 43e261fd0f8c6f6c9ff660933465727a6d48b99d Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Thu, 24 Aug 2023 22:23:09 +0200 Subject: [PATCH] Switch versioning system --- bw_processing/VERSION | 1 - bw_processing/__init__.py | 5 ++--- bw_processing/utils.py | 18 ------------------ setup.cfg | 2 +- tests/test_utils.py | 6 +++--- 5 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 bw_processing/VERSION diff --git a/bw_processing/VERSION b/bw_processing/VERSION deleted file mode 100644 index b60d719..0000000 --- a/bw_processing/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.8.4 diff --git a/bw_processing/__init__.py b/bw_processing/__init__.py index 30a3233..0b468b1 100644 --- a/bw_processing/__init__.py +++ b/bw_processing/__init__.py @@ -25,6 +25,8 @@ "UndefinedInterface", ) +__version__ = "0.8.5" + from .array_creation import create_array, create_structured_array from .constants import DEFAULT_LICENSES, INDICES_DTYPE, UNCERTAINTY_DTYPE @@ -43,6 +45,3 @@ from .merging import merge_datapackages_with_mask from .proxies import UndefinedInterface from .unique_fields import as_unique_attributes, as_unique_attributes_dataframe - -from .utils import get_version_tuple -__version__ = get_version_tuple() diff --git a/bw_processing/utils.py b/bw_processing/utils.py index 80cc163..033fd74 100644 --- a/bw_processing/utils.py +++ b/bw_processing/utils.py @@ -1,7 +1,6 @@ from io import BytesIO from pathlib import Path from typing import Any, Union -import importlib.metadata import numpy as np from numpy.lib.recfunctions import repack_fields @@ -11,23 +10,6 @@ from .errors import InvalidName -def get_version_tuple() -> tuple: - """Returns version as (major, minor, micro).""" - - def as_integer(version_str: str) -> Union[int, str]: - try: - return int(version_str) - except ValueError: - return version_str - - return tuple( - as_integer(v) - for v in importlib.metadata.version("bw-processing") - .strip() - .split(".") - ) - - def load_bytes(obj: Any) -> Any: if isinstance(obj, BytesIO): try: diff --git a/setup.cfg b/setup.cfg index a162249..f19f54b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = bw-processing -version = file: bw_processing/VERSION +version = attr: bw_processing.__version__ description = Tools to create structured arrays in a common format author = Chris Mutel maintainer = Chris Mutel diff --git a/tests/test_utils.py b/tests/test_utils.py index 0aac54a..2695baf 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -5,9 +5,9 @@ import numpy as np import pytest +from bw_processing import __version__ from bw_processing.errors import InvalidName from bw_processing.utils import ( - get_version_tuple, check_name, check_suffix, dictionary_formatter, @@ -15,8 +15,8 @@ ) -def test_get_version_tuple(): - assert isinstance(get_version_tuple(), tuple) +def test_version(): + assert isinstance(__version__, str) def test_load_bytes():