From fe858146a3418fa58aa554961f17f343f833ceb9 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 16 Jan 2024 17:30:35 +0100 Subject: [PATCH] typeguard --- README.md | 1 + manageprojects/cookiecutter_generator.py | 4 +++- manageprojects/tests/__init__.py | 5 +++++ pyproject.toml | 2 ++ requirements.dev.txt | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9a8800..81caa4d 100644 --- a/README.md +++ b/README.md @@ -333,6 +333,7 @@ See also git tags: https://github.com/jedie/manageprojects/tags [comment]: <> (✂✂✂ auto generated history start ✂✂✂) * [**dev**](https://github.com/jedie/manageprojects/compare/v0.17.1...main) + * 2024-01-16 - typeguard * 2024-01-16 - update requirements * 2023-12-30 - Fix typos * [v0.17.1](https://github.com/jedie/manageprojects/compare/v0.17.0...v0.17.1) diff --git a/manageprojects/cookiecutter_generator.py b/manageprojects/cookiecutter_generator.py index 7045f00..6693202 100644 --- a/manageprojects/cookiecutter_generator.py +++ b/manageprojects/cookiecutter_generator.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import shutil from pathlib import Path @@ -7,7 +9,7 @@ from rich.pretty import pprint -def iter_context(*, context: dict, prefix='') -> tuple: +def iter_context(*, context: dict, prefix='') -> tuple | None: for key, value in context.items(): if key.startswith('_'): continue diff --git a/manageprojects/tests/__init__.py b/manageprojects/tests/__init__.py index e6ca7ca..c4d19d7 100644 --- a/manageprojects/tests/__init__.py +++ b/manageprojects/tests/__init__.py @@ -5,6 +5,11 @@ from bx_py_utils.test_utils.deny_requests import deny_any_real_request from cli_base.cli_tools.verbosity import MAX_LOG_LEVEL, setup_logging from rich import print # noqa +from typeguard import install_import_hook + + +# Check type annotations via typeguard in all tests: +install_import_hook(packages=('manageprojects',)) def pre_configure_tests() -> None: diff --git a/pyproject.toml b/pyproject.toml index 02a5508..93f5fef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dev = [ "safety", # https://github.com/pyupio/safety "twine", # https://github.com/pypa/twine "pre-commit", # https://github.com/pre-commit/pre-commit + "typeguard", # https://github.com/agronholm/typeguard/ "tomli", # https://github.com/hukkin/tomli # @@ -170,6 +171,7 @@ applied_migrations = [ "d1ed4b1", # 2023-12-01T21:41:29+01:00 "c538ae7", # 2023-12-21T20:21:58+01:00 "7271d4c", # 2023-12-29T21:57:47+01:00 + "2f938fc", # 2024-01-16T17:26:31+01:00 ] [manageprojects.cookiecutter_context.cookiecutter] diff --git a/requirements.dev.txt b/requirements.dev.txt index f7c7c12..057cbbb 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1062,6 +1062,10 @@ twine==4.0.2 \ --hash=sha256:929bc3c280033347a00f847236564d1c52a3e61b1ac2516c97c48f3ceab756d8 \ --hash=sha256:9e102ef5fdd5a20661eb88fad46338806c3bd32cf1db729603fe3697b1bc83c8 # via manageprojects (pyproject.toml) +typeguard==4.1.5 \ + --hash=sha256:8923e55f8873caec136c892c3bed1f676eae7be57cdb94819281b3d3bc9c0953 \ + --hash=sha256:ea0a113bbc111bcffc90789ebb215625c963411f7096a7e9062d4e4630c155fd + # via manageprojects (pyproject.toml) types-python-dateutil==2.8.19.20240106 \ --hash=sha256:1f8db221c3b98e6ca02ea83a58371b22c374f42ae5bbdf186db9c9a76581459f \ --hash=sha256:efbbdc54590d0f16152fa103c9879c7d4a00e82078f6e2cf01769042165acaa2 @@ -1072,6 +1076,7 @@ typing-extensions==4.9.0 \ # via # mypy # rich-click + # typeguard urllib3==2.1.0 \ --hash=sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3 \ --hash=sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54