Skip to content

Commit

Permalink
Switch versioning system
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Aug 24, 2023
1 parent d3bd19d commit 43e261f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
1 change: 0 additions & 1 deletion bw_processing/VERSION

This file was deleted.

5 changes: 2 additions & 3 deletions bw_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
18 changes: 0 additions & 18 deletions bw_processing/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
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,
load_bytes,
)


def test_get_version_tuple():
assert isinstance(get_version_tuple(), tuple)
def test_version():
assert isinstance(__version__, str)


def test_load_bytes():
Expand Down

0 comments on commit 43e261f

Please sign in to comment.