diff --git a/CHANGES.md b/CHANGES.md index 53fae85..550d143 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## 0.0.6 (2020-07-24) + +- FIX: Development installs with `make install` do no longer fail, see #17. +- FIX: Python up to 3.7.1 does not handle type checks for `OrderedDict` properly and either causes exceptions or crashes. Fixed with workaround, see #16. + ## 0.0.5 (2020-07-24) - FEATURE: Version shown in GUI diff --git a/setup.py b/setup.py index 53d1708..0c5d394 100644 --- a/setup.py +++ b/setup.py @@ -33,10 +33,9 @@ find_packages, setup, ) +import ast import os -from abgleich import __version__ - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # SETUP # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -56,6 +55,20 @@ # Define source directory (path) SRC_DIR = "src" +# Version +def get_version(code): + tree = ast.parse(code) + for item in tree.body: + if not isinstance(item, ast.Assign): + continue + if len(item.targets) != 1: + continue + if item.targets[0].id != '__version__': + continue + return item.value.s +with open(os.path.join(SRC_DIR, 'abgleich', '__init__.py'), 'r', encoding = 'utf-8') as f: + __version__ = get_version(f.read()) + # Requirements extras_require = { "dev": ["black", "python-language-server[all]", "setuptools", "twine", "wheel",], diff --git a/src/abgleich/__init__.py b/src/abgleich/__init__.py index d9e5eec..a17d78c 100644 --- a/src/abgleich/__init__.py +++ b/src/abgleich/__init__.py @@ -28,4 +28,4 @@ # META # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -__version__ = "0.0.5" +__version__ = "0.0.6" diff --git a/src/abgleich/core/dataset.py b/src/abgleich/core/dataset.py index 16ac245..ca0de90 100644 --- a/src/abgleich/core/dataset.py +++ b/src/abgleich/core/dataset.py @@ -31,6 +31,12 @@ import datetime import typing +# Python <= 3.7.1 "fix" +try: + from typing import OrderedDict as DictType +except ImportError: + from typing import Dict as DictType + import typeguard from .abc import ConfigABC, DatasetABC, PropertyABC, TransactionABC, SnapshotABC @@ -205,7 +211,7 @@ def _new_snapshot_name(self) -> str: def from_entities( cls, name: str, - entities: typing.OrderedDict[str, typing.List[typing.List[str]]], + entities: DictType[str, typing.List[typing.List[str]]], side: str, config: ConfigABC, ) -> DatasetABC: