Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose typing information #1287

Open
kasium opened this issue Dec 7, 2021 · 6 comments
Open

Expose typing information #1287

kasium opened this issue Dec 7, 2021 · 6 comments
Labels
Enhancement ✨ Improvement to a component High effort 🏋 Difficult solution or problem to solve

Comments

@kasium
Copy link
Contributor

kasium commented Dec 7, 2021

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?

@Pierre-Sassoulas Pierre-Sassoulas added Enhancement ✨ Improvement to a component High effort 🏋 Difficult solution or problem to solve labels Dec 7, 2021
@Pierre-Sassoulas
Copy link
Member

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.

@kasium
Copy link
Contributor Author

kasium commented Dec 7, 2021

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

@cdce8p
Copy link
Member

cdce8p commented Dec 7, 2021

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.

@kasium
Copy link
Contributor Author

kasium commented Mar 8, 2023

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

@Pierre-Sassoulas
Copy link
Member

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.

@kasium
Copy link
Contributor Author

kasium commented Mar 8, 2023

Thanks for the insights!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component High effort 🏋 Difficult solution or problem to solve
Projects
None yet
Development

No branches or pull requests

3 participants