lolpack / type_coverage_py

MIT License
1 stars 1 forks source link

type_coverage_py

Calculate the Type Coverage for top Python packages.

Take the top pypi packages pulled from this project https://github.com/hugovk/top-pypi-packages

View report here: https://html-preview.github.io/?url=https://github.com/lolpack/type_coverage_py/blob/main/index.html

Methodology

This section outlines how the script analyzes Python packages, checks for typeshed availability, and calculates type coverage. The process involves three key steps: package extraction, typeshed check, and type coverage calculation.

Package Extraction

Typeshed Check

Type Coverage Calculation

This methodology ensures an accurate and detailed analysis of type coverage for popular Python packages, taking into account the presence of type stub files (.pyi) which are prioritized over implementation files (.py) for the same functions.

Usage

Clone the typeshed repo into the root of the project

git clone git@github.com:python/typeshed.git

Call the main function with the top N packages to analyze, the max is 8,000.

python main.py 100

Alternatively call with a single package

python main.py --package-name flask

Analyze the top N packages and generate both JSON and HTML reports:

python main.py 100 --write-json --write-html