Closed frallain closed 1 year ago
I wanted to release a specific version for >3.11 where I drop the import of typing-extension. If you have time could you maybe try it out https://github.com/FelixTheC/strongtyping/tree/py_3_11 if everything works like expected I will create a release for it.
When to fix?
Do you tried the branch I metioned in my last commet??
I wanted to release a specific version for >3.11 where I drop the import of typing-extension. If you have time could you maybe try it out https://github.com/FelixTheC/strongtyping/tree/py_3_11 if everything works like expected I will create a release for it.
I need use it in Pypi
获取Outlook for Androidhttps://aka.ms/AAb9ysg
From: FelixTheC @.> Sent: Saturday, May 13, 2023 12:11:28 PM To: FelixTheC/strongtyping @.> Cc: Cyan @.>; Manual @.> Subject: Re: [FelixTheC/strongtyping] Cannot validate typing of nested TypedDict having a NotRequired clause in Python 3.11 (Issue #109)
Do you tried the branch I metioned in my last commet??
I wanted to release a specific version for >3.11 where I drop the import of typing-extension. If you have time could you maybe try it out https://github.com/FelixTheC/strongtyping/tree/py_3_11 if everything works like expected I will create a release for it.
― Reply to this email directly, view it on GitHubhttps://github.com/FelixTheC/strongtyping/issues/109#issuecomment-1546520000, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQLAIBEWESTEMIE36I5MCL3XF4CXBANCNFSM6AAAAAASZEITQE. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I want to validate a dictionary with a key whose value is another dictionary. Therefore, I have a parent TypedDict with a key targeting another TypedDict.
The thing is, I am using the
NotRequired
clause, which is available in Python 3.11 natively. (see https://peps.python.org/pep-0655/#usage-in-python-3-11 )But trying to validate this dict with this configuration gives me the following import error:
Python Version used Python 3.11.1 (main, Dec 8 2022, 00:05:00) [GCC 10.2.1 20210110] on linux
Package Version used strongtyping==3.10.3
Addon in use strongtyping_modules [yes/no] : no
To Reproduce Steps to reproduce the behavior:
python:3.11.1
@match_class_typing class ChildType(TypedDict): key_a: int key_b: int
@match_class_typing class ParentType(TypedDict): child: ChildType not_required: NotRequired[int]
parent = {"not_required": 3, "child": {"key_a": 1, "key_b": "2"}} ParentType(parent)
This time, this is not an edge case, Python 3.11 should be taken into account in the way strongtyping import
NotRequired
andRequired
. Thanks again for your work!