replicate/replicate-python

Request for type hints support in replicate-python

ferdousbhai opened this issue ยท 3 comments

I would like to request type hints support for the library. ๐Ÿ™๐Ÿฝ

mattt commented

Hi @ferdousbhai. The Python library has type hints, for example:

def create( # type: ignore
self,
version: Version,
input: Dict[str, Any],
webhook: Optional[str] = None,
webhook_completed: Optional[str] = None,
webhook_events_filter: Optional[List[str]] = None,
**kwargs,
) -> Prediction:

We run mypy and ruff in CI to verify that type annotations are correct and cover the whole codebase (excluding tests).

Does that cover what you're asking for? Or did you have something else in mind?

Mypy needs an extra py.typed marker so that it can quickly check if the the package is ready for type checking. (See PEP 561).

If you want to have this already available before this is added to the package, then this can also be done manually by adding this file to the replicate folder in your site-packages.

mattt commented

@WAKayser Thanks, TIL. I just opened a PR for this here: #127