polm / fugashi

A Cython MeCab wrapper for fast, pythonic Japanese tokenization and morphological analysis.
MIT License
402 stars 33 forks source link

type stubs #62

Closed garfieldnate closed 2 years ago

garfieldnate commented 2 years ago

Using PyLance to inspect my code, I get errors when importing from fugashi: image

I believe the issue is the same as this one for lxml: because the types are in a native library, PyLance can't analyze them for type information.

The solution is to create a type stubs file. For lxml, there's a separate lxml-stubs package.

Don't know if this is a lot of work or a little bit of work, but I'll open the ticket here in case anyone else encounters the same thing.

polm commented 2 years ago

Thanks for the comment, I think your analysis of why this doesn't work is correct.

I don't use types in personal code so I have no interest in implementing this, but if someone has a PR that's easy to update I could consider it.

polm commented 2 years ago

Closing since I'm not taking any action on this.