From 1e7be246b5a6973e6a90dfe2f0d2349d30e0fffb Mon Sep 17 00:00:00 2001 From: zakstucke <44890343+zakstucke@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:47:04 +0100 Subject: [PATCH] Remove runtime dep on typing_extensions (#6) --- py_rust/python/zetch/_yaml.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/py_rust/python/zetch/_yaml.py b/py_rust/python/zetch/_yaml.py index 848f222..46ed3c0 100644 --- a/py_rust/python/zetch/_yaml.py +++ b/py_rust/python/zetch/_yaml.py @@ -1,12 +1,15 @@ -import typing_extensions as tp - - -class Update(tp.TypedDict): - # The path in the yaml file to update. - path: "list[tp.Union[str, int]]" - # If key doesn't exist will be treated as delete. - # The string will be a json str that needs to be decoded. - put: "tp.NotRequired[str]" +import typing + +# Can't use typing_extensions at runtime, would be an extra python dep. +if typing.TYPE_CHECKING: + import typing_extensions as tp + + class Update(tp.TypedDict): + # The path in the yaml file to update. + path: "list[tp.Union[str, int]]" + # If key doesn't exist will be treated as delete. + # The string will be a json str that needs to be decoded. + put: "tp.NotRequired[str]" def modify_yaml(src: str, updates: "list[Update]") -> memoryview: