jdrouet / mrml

Implementation of mjml in rust
MIT License
355 stars 22 forks source link

Add types stub to the Python package #412

Closed blopker closed 7 months ago

blopker commented 7 months ago

I just switched from https://github.com/mgd020/mjml-python to the Python package in this repo because this one tracks updates to mrml. Functionally, they run the same, which is great. However, mjml-python also has a .pyi file with the Python API type signatures in it. Can something like that be added to this Python package as well?

Pylance in VSCode just does not know what to do with the mrml module and shows an error. I have to add # type: ignore where I use mrml to clear the issue. VSCode also does not show me any usage info, which makes this package harder to use.

PyO3 seems to be working on automatic type stubs, but that hasn't fully landed yet: https://pyo3.rs/v0.21.2/python-typing-hints Side note: it also might be nice to update PyO3, but I don't know if there are any benefits.

Thanks!

blopker commented 7 months ago

Actually, updating PyO3 might be worth it. According to the migration guide: https://pyo3.rs/v0.21.2/migration, 0.21 fixes an edge case with gevent and has CPU+memory benefits.

jdrouet commented 7 months ago

Fixed, thanks to you, in https://github.com/jdrouet/mrml/releases/tag/mrml-python-v0.1.13