Skip to content

Support type-checkers and other tools#190

Closed
dogweather wants to merge 3 commits into
textstat:masterfrom
dogweather:master
Closed

Support type-checkers and other tools#190
dogweather wants to merge 3 commits into
textstat:masterfrom
dogweather:master

Conversation

@dogweather
Copy link
Copy Markdown

@dogweather dogweather commented Jul 15, 2022

Hi, I found that I needed to make a couple small changes to allow Pyright and the Language Server to work seamlessly with the library. The lib already has type hints, but I found that it needed a couple small PEP-8 fixes to fully type-check. With these changes, I also get code completion and some python docstring support. I use VS Code and Pylance/Pyright in strict mode:

Screen Shot 2022-07-15 at 3 13 44 AM

I made minimal changes which preserve the existing API.

Fixes: #191

@dogweather dogweather marked this pull request as draft July 15, 2022 11:33
@dogweather
Copy link
Copy Markdown
Author

@LKirst What do you think about the idea of this PR? I realize it's not exactly what the architecture describes. Instead I wanted to make the smallest change possible and keep the existing API.

@dogweather dogweather marked this pull request as ready for review July 20, 2022 05:41
Copy link
Copy Markdown
Member

@alxwrd alxwrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dogweather! Thank you for this. Sorry for the delay in a review.

I don't think the extra analyzer is required. The __init__.py of Textstat already imports the default instance as textstat which should be compatible with the language server.

image


Happy to add an import for TextStatistics in __init__.py though:

from .textstat import textstat, Textstatistics


__version__ = (0, 7, 2)


...

@alxwrd
Copy link
Copy Markdown
Member

alxwrd commented Oct 26, 2022

Closing as stale

@alxwrd alxwrd closed this Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Dale-Chall v2 has error in logic

2 participants