Open priba opened 3 months ago
I have no strong opinion on this matter but I am worried about the extra maintenance effort. How would you benefit from cloudpickle using type-hints? Do you use cloudpickle as a library in another library that uses type-hints?
Having cloudpickle in any type-verified project (e.g. using mypy) results in errors like
cloudpickle: module is installed, but missing library stubs or py.typed marker [import-untyped]
forcing you to add cloudpickle to type-ignore list in pyproject.toml, which isn't nice.
Also, having type annotations in the library itself may prevent some downstream user errors (e.g. they will have their ide/editor highlight type mismatches if any).
but I am worried about the extra maintenance effort.
I don't think there's too much maintenance effort - it's basically adding type annotations around all public-facing functions/methods/types, and then adding an empty py.typed
file.
For bonus points, you'd want to run mypy
in CI to make sure that type annotations are internally consistent.
Agree with @aldanor, he explained my current issues.
I am adding cloudpickle
into type-ignore
so mypy
does not complain. I assume several people are dealing with this.
I don't think there's too much maintenance effort - it's basically adding type annotations around all public-facing functions/methods/types, and then adding an empty py.typed file.
We can indeed start with a minimal PR that adds type annotations to the public API of cloudpickle only and later decide if we want to generalize type annotations to private functions/methods for follow-up PRs.
If there are any volunteer in the room, feel free to open a PR for the first part.
The adoption of type-hints is becoming popular in the python community. Are there plans to add type hints within cloudpickle?