iscc / iscc-sdk

ISCC - Software Development Kit
https://sdk.iscc.codes
Apache License 2.0
10 stars 5 forks source link

Fix missing type annotations in documentation #124

Open titusz opened 4 months ago

titusz commented 4 months ago

mkdocstrings does not seem to support PEP 484 type comments

pawamoy commented 4 months ago

Hi! We definitely support type hints :) don't hesitate to open issues with minimal reproducible examples in our bug tracker ^^

pawamoy commented 4 months ago

Ah, sorry, I read type hints instead of type comments. We don't support comments indeed.

titusz commented 4 months ago

What I like about PEP 484 type comments for function annotations is that they can make many function signatures much more readable. For example:

def process_data(raw_data: List[Dict[str, str]], config: Optional[Dict[str, str]] = None) -> List[int]:
    """Process raw data according to config."""
    pass

becomes:

def process_data(raw_data, config=None):
    # type: (List[Dict[str, str]], Optional[Dict[str, str]]) -> List[int]
    """Process raw data according to config."""
    pass

And type comment based function annotations are well supported by mypy and IDEs like PyCharm. @pawamoy Do you think that would be something to consider to support with griffe?

pawamoy commented 4 months ago

Fortunately, ast can parse type comments, so we can consider supporting them. Not a priority though since we have type annotations. Could be an Insiders feature :)