pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Expose types

Open jacobtylerwalls opened this issue 3 years ago • 7 comments

Type of Changes

Type
:sparkles: New feature

Description

Closes #5488

We have #2079 to track further "high-hanging fruit" missing type annotations, but the most important ones are done, so let's expose them finally.

Edit by @DanielNoord: This can now also close #2079 as the typing is now (almost) complete

jacobtylerwalls avatar Jul 03 '22 13:07 jacobtylerwalls

Pull Request Test Coverage Report for Build 2605232781

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.358%

Totals Coverage Status
Change from base Build 2601041076: 0.0%
Covered Lines: 16702
Relevant Lines: 17515

💛 - Coveralls

coveralls avatar Jul 03 '22 13:07 coveralls

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 237711daefbc4505f9743839ebbdb361f769bb08

github-actions[bot] avatar Jul 03 '22 14:07 github-actions[bot]

I'm not sure if we should do this. As long as astroid can't pass mypy I'm not truly comfortable that all of our typing is correct. Might be better to wait until that has been finished?

DanielNoord avatar Jul 03 '22 14:07 DanielNoord

I'm not sure if we should do this. As long as astroid can't pass mypy I'm not truly comfortable that all of our typing is correct. Might be better to wait until that has been finished?

I hear that, but it's correct for the current version, right? If future versions of astroid change, then future versions of pylint change, but that's not an issue for people developing against the current version of pylint.

jacobtylerwalls avatar Jul 03 '22 14:07 jacobtylerwalls

I hear that, but it's correct for the current version, right? If future versions of astroid change, then future versions of pylint change, but that's not an issue for people developing against the current version of pylint.

Well, we think the typing is correct. But, to give an example, we also run into the issue described in https://github.com/PyCQA/astroid/issues/1680 in pylint as we use it at least once. By adding py.typed we signal that we think that our current typing is at least correct and can only be expanded to include additional signatures, but I wouldn't be 100% that it is actually correct.

DanielNoord avatar Jul 03 '22 14:07 DanielNoord

Sorry I approved without giving my reasonning. I thought that astroid had to be typed before pylint too, but there's some level of separation between pylint and astroid, and most pylint API do not expose astroid's API, so it's probably correct enough and useful enough. Also we'll get issue for the part that are used, maybe even contributions.

Pierre-Sassoulas avatar Jul 03 '22 14:07 Pierre-Sassoulas

By adding py.typed we signal that we think that our current typing is at least correct and can only be expanded to include additional signatures, but I wouldn't be 100% that it is actually correct.

Until you mentioned PyCQA/astroid#1680 I would have said we are confident that it is correct given current state of astroid, which is all we can ever promise. (Even if we know astroid will keep changing.) But PyCQA/astroid#1680 is a good point -- we know that's wrong. So I'm happy to postpone this.

jacobtylerwalls avatar Jul 03 '22 14:07 jacobtylerwalls

Don't forget to add the py.typed to the pylint entry for tool.setuptools.package-data in pyproject.toml

KotlinIsland avatar Jan 24 '23 06:01 KotlinIsland

Superseded by https://github.com/PyCQA/pylint/pull/8402

DanielNoord avatar Mar 08 '23 18:03 DanielNoord