๐Ÿ“ฆ AlexWaygood / typeshed-stats

Library and command-line tool to gather stats on typeshed packages

โ˜… 12 stars โ‘‚ 5 forks ๐Ÿ‘ 12 watching โš–๏ธ MIT License
pythonpython-typingtypeshedtyping
๐Ÿ“ฅ Clone https://github.com/AlexWaygood/typeshed-stats.git
HTTPS git clone https://github.com/AlexWaygood/typeshed-stats.git
SSH git clone git@github.com:AlexWaygood/typeshed-stats.git
CLI gh repo clone AlexWaygood/typeshed-stats
statsabot statsabot ๐Ÿ‘ท Automated regeneration of examples and docs 7122d5f 17 hours ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ examples
๐Ÿ“ scripts
๐Ÿ“ src
๐Ÿ“ stats_website
๐Ÿ“ tests
๐Ÿ“„ .editorconfig
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ .markdownlint.yaml
๐Ÿ“„ LICENSE
๐Ÿ“„ mkdocs.yml
๐Ÿ“„ pyproject.toml
๐Ÿ“„ README.md
๐Ÿ“„ website_macros.py
๐Ÿ“„ README.md

typeshed-stats

A Python in a field of wheat with a shed behind it, golden-red sunset in the background



A CLI tool and library to gather stats on typeshed


websitebuild status
Checked with mypyCode style: Ruffpre-commit
PyPIPyPI - Wheellicense



What's this project for?

This project is for easy gathering of statistics relating to typeshed's stubs. As well as being a CLI tool and library, it also powers a website where stats about typeshed's stubs are uploaded twice a day.

This project was created by Alex Waygood. It is not necessarily endorsed by any of the other typeshed maintainers.

Some examples of things you can do from the command line:

  • Create a .csv file with stats on all typeshed stubs: typeshed-stats --typeshed-dir <PATH_TO_TYPESHED_CLONE> --to-file stats.csv (the .csv file extension will be automatically detected by the script to identify the format required).
  • Pretty-print stats on typeshed stubs for emoji and redis to the terminal, in JSON format: typeshed-stats --typeshed-dir <PATH_TO_TYPESHED_CLONE> --to-json emoji redis
  • Generate a MarkDown file detailing stats on typeshed's stubs for protobuf and the stdlib: typeshed-stats --typeshed-dir <PATH_TO_TYPESHED_CLONE> --to-file stats.md stdlib protobuf
  • Open the upstream repository URLs for requests, Flask-SocketIO and CPython in your default web browser: typeshed-stats --typeshed-dir <PATH_TO_TYPESHED_CLONE> --upstream-repo requests Flask-SocketIO stdlib
Example usage of the Python-level API:

from typeshed_stats.gather import tmpdir_typeshed, gather_stats

with tmpdir_typeshed() as typeshed:
    stats_on_all_packages = gather_stats_on_multiple_packages(typeshed_dir=typeshed)

How can I use this?

  • Run pip install typeshed-stats[rich] to install the package
  • Run typeshed-stats --help for information about various options

Are there any examples of things this script can produce, other than the website?

I'm glad you asked! They're in the examples/ folder in this repo. (These examples are generated using the regenerate.py script in the scripts/ directory.)

How do I run tests/linters?

  • Clone the repo and cd into it
  • Create and activate a virtual environment
  • Run pip install -e .[dev]
  • Either run the linters/tests individually (see the .github/workflows directory for details about what's run in CI) or use the scripts/runtests.py convenience script to run them all in succession.