Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexwaygood/typeshed-stats
Library and command-line tool to gather stats on typeshed packages
https://github.com/alexwaygood/typeshed-stats
python python-typing typeshed typing
Last synced: about 2 months ago
JSON representation
Library and command-line tool to gather stats on typeshed packages
- Host: GitHub
- URL: https://github.com/alexwaygood/typeshed-stats
- Owner: AlexWaygood
- License: mit
- Created: 2022-10-09T23:59:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T12:44:02.000Z (4 months ago)
- Last Synced: 2024-10-29T15:12:53.935Z (4 months ago)
- Topics: python, python-typing, typeshed, typing
- Language: Python
- Homepage: https://alexwaygood.github.io/typeshed-stats/
- Size: 5.19 MB
- Stars: 9
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typeshed-stats
---
## A CLI tool and library to gather stats on [typeshed](https://github.com/python/typeshed)
[](https://alexwaygood.github.io/typeshed-stats/)[](https://github.com/AlexWaygood/typeshed-stats/actions/workflows/test.yml)
[](http://mypy-lang.org/)[](https://github.com/astral-sh/ruff)[](https://pre-commit.ci)
[](https://pypi.org/project/typeshed-stats/)[](https://opensource.org/licenses/MIT)---
## What's this project for?
This project is for easy gathering of statistics relating to [typeshed](https://github.com/python/typeshed)'s stubs. As well as being a CLI tool and library, it also powers [a website](https://alexwaygood.github.io/typeshed-stats/) 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 --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 --to-json emoji redis`
- Generate a MarkDown file detailing stats on typeshed's stubs for protobuf and the stdlib: `typeshed-stats --typeshed-dir --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 --upstream-repo requests Flask-SocketIO stdlib`Example usage of the Python-level API:
```python
from typeshed_stats.gather import tmpdir_typeshed, gather_statswith tmpdir_typeshed() as typeshed:
stats_on_all_packages = gather_stats_on_multiple_packages(typeshed_dir=typeshed)
```## How can I use this?
1. Run `pip install typeshed-stats[rich]` to install the package
1. Run `typeshed-stats --help` for information about various options## Are there any examples of things this script can produce, other than [the website](https://alexwaygood.github.io/typeshed-stats/)?
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?
1. Clone the repo and `cd` into it
1. Create and activate a virtual environment
1. Run `pip install -e .[dev]`
1. 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.