When used with the pyright / pylance type checker, this effectively pollutes fastavro API usage with type warnings, as "Dict" is seen as "Dict[Unknown]".
Yeah, I think this makes sense as a stop gap. With how things are I'm not sure when I'll have time to finish up the other branch. If you are able to make the PR it will be quicker to get in.
The current main branch has implementation in https://github.com/fastavro/fastavro/blob/master/fastavro/types.py which uses Python generic types (
Dict
,List
) with insufficient type parameterization.When used with the pyright / pylance type checker, this effectively pollutes fastavro API usage with type warnings, as "Dict" is seen as "Dict[Unknown]".
I am aware of the existence of the "better_typing" branch at https://github.com/fastavro/fastavro/blob/better_typing/fastavro/types.py and do notice considerable effort going into providing comprehensive typing support.
Still, possibly as a temporary stop-gap measure, refactoring the existing implementation on main to use the
Any
type, for instance likecould make a lot of code "type-safe" simply by declaring "anything goes, don't know", effectively suppressing the type warnings at the library end. (cf https://docs.python.org/3/library/typing.html#the-any-type)
The
Any
type was introduced with Python 3.5, so it should be usable.Happy to provide a PR if that is a way forward?