confluentinc / confluentinc/confluent-kafka-python
Wrong signature for `KafkaError`'s 1st parameter in `.pyi`
- Dominant language
- Python
- Stars
- 509
- Forks
- 964
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 14
Description
The name of the 1st parameter for `KafkaError`'s initialiser in `src/confluent_kafka/cimpl.pyi` is now `code` (ref [here](https://github.com/confluentinc/confluent-kafka-python/blob/7d0abd551c5061e655fbf403f9baa09af040e29b/src/confluent_kafka/cimpl.pyi#L229-L230)), however this does not match the underlying code itself.
For example, if we try to create an instance of `KafkaError` according to the signature:
```python
# kafka_error_test.py
from confluent_kafka import KafkaError
error = KafkaError(code=1)
```
Then `mypy` is OK with this
```
# mypy kafka_error_test.py
Success: no issues found in 1 source file
```
But we get a `TypeError` when it runs
```
# python kafka_error_test.py
Traceback (most recent call last):
File "/workspaces/kafka_error_test.py", line 5, in
error = KafkaError(code=1)
```
I'm happy to submit a PR to fix this but which way do we want to go here? Change the signature in the `.pyi` file so it matches what [the underlying C code expects](https://github.com/confluentinc/confluent-kafka-python/blob/7d0abd551c5061e655fbf403f9baa09af040e29b/src/confluent_kafka/src/confluent_kafka.c#L310-L313)? Or change the underlying C code to match up with the signature?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.