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

Support .pyi python files #1075

Merged
merged 1 commit into from
May 2, 2024
Merged

Support .pyi python files #1075

merged 1 commit into from
May 2, 2024

Conversation

konstin
Copy link
Contributor

@konstin konstin commented Mar 15, 2024

Python uses .pyi files for type stubs, type annotations that live outside the main source code. While these files are not executed, they contain valid python and are written and read as such by humans and tools such as type checkers and IDEs.

On typeshed, the main repository for type stubs in python:

before

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Language            Files        Lines         Code     Comments       Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 INI                     1            7            7            0            0
 JSON                    4          217          217            0            0
 Python                 77         7687         5514          624         1549
 Shell                   2          152           88           43           21
 Plain Text            160         4283            0         3870          413
 TOML                  157          897          708          112           77
───────────────────────────────────────────────────────────────────────────────
 Markdown                6         1177            0          925          252
 |- BASH                 3           28           27            1            0
 |- PowerShell           1            4            4            0            0
 |- Python               3           47           39            0            8
 (Total)                           1256           70          926          260
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Total                 407        14499         6604         5575         2320
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

after

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Language            Files        Lines         Code     Comments       Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 INI                     1            7            7            0            0
 JSON                    4          217          217            0            0
 Python               4386       280564       252860         4131        23573
 Shell                   2          152           88           43           21
 Plain Text            160         4283            0         3870          413
 TOML                  157          897          708          112           77
───────────────────────────────────────────────────────────────────────────────
 Markdown                6         1177            0          925          252
 |- BASH                 3           28           27            1            0
 |- PowerShell           1            4            4            0            0
 |- Python               3           47           39            0            8
 (Total)                           1256           70          926          260
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Total                4716       287376       253950         9082        24344
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Python uses `.pyi` files for [type stubs](https://typing.readthedocs.io/en/latest/source/stubs.html), type annotations that live outside the main source code. While these files are not executed, they contain valid python and are written and read as such by humans and tools such as type checkers and IDEs.
@XAMPPRocky
Copy link
Owner

Thank you for your PR, and congrats on your first contribution! 🎉

@XAMPPRocky XAMPPRocky merged commit dfaf79b into XAMPPRocky:master May 2, 2024
71 checks passed
@konstin konstin deleted the pyi branch May 2, 2024 16:31
ErikSchierboom pushed a commit to exercism/tokei that referenced this pull request Jun 7, 2024
ErikSchierboom pushed a commit to exercism/tokei that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants