-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-2921: Strict Type Checking #953
base: main
Are you sure you want to change the base?
Conversation
e1cd422
to
c82fb1f
Compare
I like this, what's the status? |
To be honest, I am a little stuck. It seems to me there are places where the types in avro-python aren't mathematically sound and can't be correctly described using type hints. (In particular, the subclassing of types of Schema don't always graph right.) In the long run, I think a breaking refactor will be required to make those type-able. But I guess we can ignore those for now. The bigger issue is that mypy doesn't support recursive types, which I think severely limits the usefulness of type hinting in Avro. Avro schema is obviously suited to a recursive description of what it can serialize. I've played with a bunch of approaches, including an arbitrary recursion-depth limit (which Python has anyway for stack recursion), but it's a bit depressing, so I took a step away from this for a while. Mypy continues to improve, so I hope that with future improvements this will become increasingly useful. In the mean time, I will see about fixing it up and merging it for partial advances in type hinting from avro-python. |
c178395
to
5aca8e2
Compare
@kojiromike at least having some top level type-checking is till very useful for catching errors. |
@asosnovsky-sumologic Yep, I saw that and will see about getting back into this. Pretty busy in my personal life, so others are welcome to give it a shot if you can get it done faster than I can. |
This is the first pass at adding type hints across all of avro in python.
strict = true
to mypy configuration, which will help ensure future changes are consistent, type-wise.# type: ignore
comments to avoid having to make API breaking changes to fix type errors.Jira
Tests
Commits
Documentation