Skip to content

Python typing is not working wellΒ #2060

@wernerdaehn

Description

@wernerdaehn

Example: Creating the Avro Serializer
Following the example at https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/avro_producer.py

Image

the IDE (Visual Studio Code) shows the parameter names as invalid.

The reason why is obvious when looking at the source code of confluent.avro.

It does not have an def __init__(...) but

    def __init_impl(
        self,
        schema_registry_client: SchemaRegistryClient,
        schema_str: Union[str, Schema, None] = None,
        to_dict: Optional[Callable[[object, SerializationContext], dict]] = None,
        conf: Optional[dict] = None,
        rule_conf: Optional[dict] = None,
        rule_registry: Optional[RuleRegistry] = None
    ):

and assigns the method at class level

__init__ = __init_impl

Not good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code:pythonIssues that are specific to Python or versions of Python independent of library logiccomponent:serdesAvro, JSON, Protobof, Schema-registryenhancementRequesting a feature changepriority:highMaintainer triage tag for indicating high impact or criticality issuessize:smallMaintainer triage tag for indicating change required is particularly small

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions