Open george-zubrienko opened 11 months ago
I have some technical questions here.
typing
stuff? If so, should we use backports from typing-extensions
?typing.TYPE_CHECK
typing.TYPE_CHECKING
parameter or in the .pyi
header files?Great questions, my thoughts below
I have some technical questions here.
- Which versions of Python should we support?
I'm in favour of hard-locking v1 API in >=3.8
- Should we use some new cool
typing
stuff? If so, should we use a backports fromtyping-extensions
?
I think it depends on feature state of such stuff. Stable features, why not. Re backports, I don't think we can avoid those unless min version for v1 API is set really high like 3.10, which will make it unusable for many users imo.
- Should we hide the type hints, type checkers, and so on behind the
typing.TYPE_CHECK
parameter or in the.pyi
header files?
Type hints should stay imo, python code w/o them is close to being unreadable. That said, we probably should provide pyi files anyway since they help static code analyzers
Question 3 should be read as follows:
Should we keep type hints as runtime-processed annotations (see example 1); or hide them in the non-executing blocks such as if statements, header files, or annotation comments (see examples 2, 3)?
Corrected typos & a small syntax error in each code snippet. Now they look as intended.
Description
I would like to kick off some work on new API by implementing the following:
JsonSerializer[MyType]
orJsonSerializer(MyType)
which should support:dataclasses_json.register(JsonSerializer[MyType])
. Automatic registration of all classes in a module should come laterto_json(object)
andto_json(MyType, object)
from_json(MyType, object)
Possible solution
No response
Alternatives
To be discussed in the PR
Context
Suggested reviewers: @USSX-Hares , @s-vitaliy , @matt035343 and @lidatong