-
Notifications
You must be signed in to change notification settings - Fork 919
Open
Labels
code:pythonIssues that are specific to Python or versions of Python independent of library logicIssues that are specific to Python or versions of Python independent of library logiccomponent:schema-registryAny schema registry related isues rather than kafka isolated onesAny schema registry related isues rather than kafka isolated onesgood first issueHelpful tag for inviting new users to contributeHelpful tag for inviting new users to contributemaintenanceAny tech debt or routine action tasks that should be tracked with an issueAny tech debt or routine action tasks that should be tracked with an issue
Description
Description
I use Pycharm as my IDE, and I dislike seeing complaints about type mismatch.
The value
attribute of Message objects is typed as Optional[Union[str, bytes]]
.
However, AvroConsumer
s set that value to the deserialized message, i.e. whatever python datatype match the avro schema(most often, a dict
). This generates red flags for any type checkers when I treat that value as a dict(or whatever I expect the deserialized message to be).
Not sure what's the best way to change the type hinting when using C bindings.
Edit: Also, Pycharm thinks Message.value
takes a payload
argument. Not sure why that is.
How to reproduce
e.g.
consumer = AvroConsumer(...)
message = consumer.poll()
field = message.value().get("field") # Pycharm highlights this as an error
Checklist
Please provide the following information:
- confluent-kafka-python and librdkafka version (
confluent_kafka.version()
andconfluent_kafka.libversion()
):confluent_kafka.version() = ('0.11.5', 722176)
,confluent_kafka.libversion() = ('0.11.5', 722431)
- Apache Kafka broker version: N/A
- Client configuration: N/A
- Operating system: N/A
- Provide client logs (with
'debug': '..'
as necessary) - Provide broker log excerpts
- Critical issue
Metadata
Metadata
Assignees
Labels
code:pythonIssues that are specific to Python or versions of Python independent of library logicIssues that are specific to Python or versions of Python independent of library logiccomponent:schema-registryAny schema registry related isues rather than kafka isolated onesAny schema registry related isues rather than kafka isolated onesgood first issueHelpful tag for inviting new users to contributeHelpful tag for inviting new users to contributemaintenanceAny tech debt or routine action tasks that should be tracked with an issueAny tech debt or routine action tasks that should be tracked with an issue