confluent-kafka-python
confluent-kafka-python copied to clipboard
Wrong signature in docstring
Description
When passing in a logger to the Consumer / Producer constructors, PyCharm complains that logger is an unexpected argument, even though it is not. I think happens because PyCharm reads the expected signature from the docstring, which is defined here and here with the wrong signature.
How to reproduce
Open an interactive Python shell, and type in:
from logging import getLogger
from confluent_kafka import Consumer
logger = getLogger()
consumer = Consumer({"group.id": "foo"}, logger=logger) # No complaints
Consumer.__doc__
Out[18]: 'A high-level Apache Kafka consumer\n\n.. py:function:: Consumer(config)\n\nCreate a new Consumer instance using the provided configuration *dict* (including properties and callback functions). See :ref:`pythonclient_configuration` for more information.\n\n:param dict config: Configuration properties. At a minimum, ``group.id`` **must** be set and ``bootstrap.servers`` **should** be set.\n'
Checklist
Please provide the following information:
- [x] confluent-kafka-python and librdkafka version: ('1.7.0', 17235968) and ('1.7.0', 17236223)
- [x] Operating system: Ubuntu 20.04.3 LTS
Hi @danhje, thanks for bring this up, we didn't expose kwargs because consumer = Consumer({"group.id": "foo"}, logger=logger) which is identical to: consumer = Consumer({"group.id": "foo", "logger": mylogger})
There is a discussion related to this: https://github.com/confluentinc/confluent-kafka-python/pull/397
https://github.com/confluentinc/confluent-kafka-python/pull/1447