Skip to content

feat: Generate __init__ methods for typed dicts with **kwargs: Unpack[MyDict] to help docstring parser fetch other parameters types #284

@butterlyn

Description

@butterlyn

Description of the bug

TypedDict classes gets a griffe warning "Parameter does not appear in the function signature" when correctly including the parameters in the docstring. (Note: TypedDict's do not include an explicit def __init__() constructor)

To Reproduce

class MyTypedDict(TypedDict):
    """
    Parameters
    ----------
    first_dict_key: str
        First dictionary key.
    second_dict_key: str
        Second dictionary key.
    """
    first_dict_key: str
    second_dict_key: str

Full traceback

$ mkdocs build --strict
WARNING -  griffe: src\aemo_databricks\sql\types.py:28: Parameter 'first_dict_key' does not appear in the function signature
WARNING -  griffe: src\aemo_databricks\sql\types.py:28: Parameter 'second_dict_key' does not appear in the function signature

Expected behavior

These warnings should not be raised, since (unlike normal python classes) first_dict_key and second_dict_key are parameters for instantiating the class, not class attributes.

Additional context

I'm using --strict flag for cicd testing of my MkDocs documentation, my cicd pipeline is failing due to this warning.

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions