Open Sophon96 opened 1 week ago
Interesting, which parts do you think would be most helpful to add type hints for?
~The project doesn't have many different types, and~ inputs are basically two native cramjam objects (cramjam.File, cramjam.Buffer), and then what I guess would be Buffer type. (anything implementing the buffer protocol).
Could be nice, but I think it's low priority for me at the moment; mostly because it's completely decoupled from existing Rust code which isn't appealing and seems PyO3 is on the way to provide automated typing anyhow https://pyo3.rs/v0.22.2/python-typing-hints.html.
Would entertain a PR though if you're eager for it.
Edit: in reflection, it does have a decent amount of types when accounting for different input types for other algorithms like blosc2, xz and maybe some others.
Thanks for the reply. It would be nice to have stub files for the modules and functions, as that would enable intellisense and linters to function.
I do agree with your reasoning about this issue being low-priority. It’s definitely awkward that the stubs are decoupled from the rust code, but it looks like PyO3 is a while away from finishing the automated type inspections (might be wrong, only took a quick glance at the issue thread).
I’ve got a PR in-progress; I’ll send it over when it's done.
On Wed, Sep 11, 2024 at 4:43 AM Miles Granger @.***> wrote:
Interesting, which parts do you think would be most helpful to add type hints for?
The project doesn't have many different types, and inputs are basically two native cramjam objects (cramjam.File, cramjam.Buffer), and then what I guess would be Buffer https://docs.python.org/3.12/library/collections.abc.html#collections.abc.Buffer type. (anything implementing the buffer protocol).
Could be nice, but I think it's low priority for me at the moment; mostly because it's completely decoupled from existing Rust code which isn't appealing and seems PyO3 is on the way to provide automated typing anyhow https://pyo3.rs/v0.22.2/python-typing-hints.html.
Would entertain a PR though if you're eager for it.
— Reply to this email directly, view it on GitHub https://github.com/milesgranger/cramjam/issues/173#issuecomment-2343438940, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARC5EIHT6FXFPD2ZRODWNWDZWAUGDAVCNFSM6AAAAABN5ZQ7XGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBTGQZTQOJUGA . You are receiving this because you authored the thread.Message ID: @.***>
Hello,
This library has been really useful for me, but I believe the developer experience would be greatly enhanced with the addition of type hints. The addition of type hints would allow IDEs to show intellisense completions, and other tooling, like linters or type checkers to do their job. It currently appears that the only way to define type hints with rust/Python ffi is to add type stubs to the wheel during build process.
Best, Brandon