From b6c1f829e165f1e2f57a661015025b9bc74642f5 Mon Sep 17 00:00:00 2001 From: Denis Navarro Date: Thu, 18 Nov 2021 14:53:25 +0100 Subject: [PATCH] release(1.3.2): Add "dataclasses" peer dependency for Python 3.6 to allow use events.py and improve "get_env" function from utils.py to allow avoid casting to str the default option given keeping the behaviour retrocompatibility but extending the return type as optional --- aioddd/utils.py | 4 ++-- pyproject.toml | 4 ++-- pyscript.sh | 8 ++++---- requirements-dev.txt | 10 +++++----- requirements.txt | 1 + 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/aioddd/utils.py b/aioddd/utils.py index 18437cb..bce70f4 100644 --- a/aioddd/utils.py +++ b/aioddd/utils.py @@ -3,10 +3,10 @@ from typing import Any, Dict, Optional, Type, TypeVar, Union -def get_env(key: str, default: Optional[str] = None) -> str: # pragma: no cover +def get_env(key: str, default: Optional[str] = None, cast_default_to_str: bool = True) -> Optional[str]: """Get an environment variable, return default if it is empty or doesn't exist.""" value = getenv(key, default) - return str(default) if not value or len(value) == 0 else value + return str(default) if cast_default_to_str else default if not value or len(value) == 0 else value def get_simple_logger( diff --git a/pyproject.toml b/pyproject.toml index 034aff1..d58ef79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [metadata] name = "aioddd" -version = "1.3.1" +version = "1.3.2" description = "Async Python DDD utilities library." license = "MIT" authors = ["ticdenis "] @@ -13,7 +13,7 @@ include = ["LICENSE", "README.md"] [build-system] build-backend = "setuptools.build_meta" -requires = ["setuptools==58.5.3", "wheel==0.37.0"] +requires = ["setuptools==59.1.1", "wheel==0.37.0"] [tool.black] include = '\.pyi?$' diff --git a/pyscript.sh b/pyscript.sh index 3f786b0..ebbba4f 100755 --- a/pyscript.sh +++ b/pyscript.sh @@ -101,10 +101,10 @@ export PYTHONUNBUFFERED=1 # shellcheck disable=SC2269 case "$function" in --h | --help) function=help ;; --v | --version) function=version ;; -help | version | build | build_docs | deploy | install | fmt | security_analysis | static_analysis | test | coverage | clean) function=$function ;; +-h | --help | help) function=help ;; +-v | --version | version) function=version ;; +build | build_docs | deploy | install | fmt | security_analysis | static_analysis | test | coverage | clean) function=$function ;; *) echo >&2 "pyscript: '$function' is not a pyscript command." && exit 1 ;; esac -eval "_$function" "$@" +"_$function" "$@" diff --git a/requirements-dev.txt b/requirements-dev.txt index 37149de..1dadad1 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ -r requirements.txt autoflake==1.4 -bandit==1.7.0 -black==21.10b0 +bandit==1.7.1 +black==21.11b1 commitizen==2.20.0 isort==5.10.1 liccheck==0.6.2 @@ -16,9 +16,9 @@ pytest-asyncio==0.16.0 pytest-cov==3.0.0 pytest-xdist==2.4.0 pytoml==0.1.21 -setuptools==58.5.3 -shellcheck-py==0.7.2.1 -twine==3.5.0 +setuptools==59.1.1 +shellcheck-py==0.8.0.1 +twine==3.6.0 types-dataclasses==0.6.1; python_version <= "3.6" types-backports==0.1.3; python_version <= "3.6" wheel==0.37.0 diff --git a/requirements.txt b/requirements.txt index c0d15ba..e0bd262 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ backports-datetime-fromisoformat>=1.0.0; python_version <= "3.6" +dataclasses>=0.8; python_version <= "3.6"