optax icon indicating copy to clipboard operation
optax copied to clipboard

Publishing with `py.typed`

Open tmke8 opened this issue 5 months ago • 2 comments

It seems most public-facing functions have type annotations in optax, so would the project be interested in publishing the package with a py.typed file for marking the package as having type annotations?

I can send a PR if there is interest.

tmke8 avatar Jul 21 '25 10:07 tmke8

I think that's a great idea!

I need to catch up on how to verify this works correctly, do you have an idea on testing this?

rdyro avatar Jul 21 '25 18:07 rdyro

mypy and pyright on strict mode will complain if the py.typed file is not present, not sure about pytype. Perhaps one could also build the wheel, then uncompress it and check whether py.typed is there.

I looked at how haiku dealt with the file being added; it was in this PR: https://github.com/google-deepmind/dm-haiku/pull/103 but it's not apparent if any testing was performed there.

tmke8 avatar Jul 22 '25 14:07 tmke8