pylint-dev/astroid

Expose typing information

Opened this issue · 6 comments

Hi all,

if a library is using astroid and would like to check types (e.g. with mypy), the library first needs to have typing information and expose a "py.typed" file in the root package. First is partially done (AFAIK) but second not.

Can you please consider this?

Hello, we already spent hundred of hours in this, as @DanielNoord can corroborate 😄 We're close to being able to activate mypy, probably not with --strict but astroid was not designed with strict typing on the radar, and there's a lot of issues that need to be resolved first. See #1217 or #1249 for example among dozen of other similar MR.

This is a prerequisite to doing the same in Pylint.

Wow, great! I guess you then also expose the types by adding a py.typed file, right?

Wow, great! I guess you then also expose the types by adding a py.typed file, right?

Yes, once we've enabled mypy and can be confident the types are correct.

Hi guys,
can you please shortly share the current status? Can you please give a hint where to contribute?
Given that pylint is now typed and mypyc would be cool performance boost, I see this topic as rather important

The bottleneck in pylint performance is not pylint itself but in astroid and astroid is not typed properly right now (We can't even activate mypy in non strict mode). But we exposed pylint's typing becase there's some level of separation between pylint and astroid, and most pylint API do not expose astroid's API, so it's correct enough and useful enough to be exposed.

There's another possible avenue for improvement on top of mypyc in #2014 but in all case it seems a major refactor with huge breaking changes is required to be able to type astroid correctly (#2014 (comment)) -- or do anything really.

Thanks for the insights!