typeshed_stats 22.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. typeshed_stats-22.11.0/.coveragerc +2 -0
  2. typeshed_stats-22.11.0/.editorconfig +12 -0
  3. typeshed_stats-22.11.0/.flake8 +32 -0
  4. typeshed_stats-22.11.0/.gitattributes +2 -0
  5. typeshed_stats-22.11.0/.github/dependabot.yml +10 -0
  6. typeshed_stats-22.11.0/.github/workflows/check.yml +111 -0
  7. typeshed_stats-22.11.0/.github/workflows/publish.yml +32 -0
  8. typeshed_stats-22.11.0/.github/workflows/regen-examples-and-docs.yml +65 -0
  9. typeshed_stats-22.11.0/.gitignore +75 -0
  10. typeshed_stats-22.11.0/.pre-commit-config.yaml +33 -0
  11. typeshed_stats-22.11.0/LICENSE +19 -0
  12. typeshed_stats-22.11.0/PKG-INFO +81 -0
  13. typeshed_stats-22.11.0/README.md +46 -0
  14. typeshed_stats-22.11.0/examples/example.csv +136 -0
  15. typeshed_stats-22.11.0/examples/example.html +4588 -0
  16. typeshed_stats-22.11.0/examples/example.json +2702 -0
  17. typeshed_stats-22.11.0/examples/example.md +4318 -0
  18. typeshed_stats-22.11.0/mkdocs.yml +6 -0
  19. typeshed_stats-22.11.0/pyproject.toml +86 -0
  20. typeshed_stats-22.11.0/requirements-dev.txt +24 -0
  21. typeshed_stats-22.11.0/scripts/regenerate_examples_and_docs.py +62 -0
  22. typeshed_stats-22.11.0/scripts/runtests.py +130 -0
  23. typeshed_stats-22.11.0/src/typeshed_stats/__init__.py +18 -0
  24. typeshed_stats-22.11.0/src/typeshed_stats/__main__.py +13 -0
  25. typeshed_stats-22.11.0/src/typeshed_stats/_cli.py +312 -0
  26. typeshed_stats-22.11.0/src/typeshed_stats/gather.py +583 -0
  27. typeshed_stats-22.11.0/src/typeshed_stats/py.typed +0 -0
  28. typeshed_stats-22.11.0/src/typeshed_stats/serialize.py +138 -0
  29. typeshed_stats-22.11.0/stats_website/index.md +6 -0
  30. typeshed_stats-22.11.0/stats_website/stats.md +4320 -0
  31. typeshed_stats-22.11.0/tests/__init__.py +0 -0
  32. typeshed_stats-22.11.0/tests/conftest.py +222 -0
  33. typeshed_stats-22.11.0/tests/test___all__.py +82 -0
  34. typeshed_stats-22.11.0/tests/test__cli.py +630 -0
  35. typeshed_stats-22.11.0/tests/test_gather.py +537 -0
  36. typeshed_stats-22.11.0/tests/test_running_from_command_line.py +16 -0
  37. typeshed_stats-22.11.0/tests/test_serialize.py +62 -0
@@ -0,0 +1,2 @@
1
+ [run]
2
+ relative_files = True
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*.{py,rst,md,yml,yaml,toml,json}]
4
+ trim_trailing_whitespace = true
5
+ insert_final_newline = true
6
+ indent_style = space
7
+
8
+ [*.{py,toml,json}]
9
+ indent_size = 4
10
+
11
+ [*.{yml,yaml}]
12
+ indent_size = 2
@@ -0,0 +1,32 @@
1
+ # Rules that are ignored:
2
+ #
3
+ # The following rule now goes against PEP8:
4
+ # W503 line break before binary operator
5
+ #
6
+ # The following rules are incompatible with or largely enforced by black:
7
+ # B950 Line too long (flake8-bugbear equivalent of E501)
8
+ # E203 whitespace before
9
+ # E501 line too long
10
+ # W291 trailing whitespace
11
+ # W293 blank line contains whitespace
12
+ #
13
+ # I disagree with these stylistic lints from flake8-pytest-style and flake8-simplify
14
+ # SIM905
15
+ # PT004
16
+ # PT005
17
+
18
+ [flake8]
19
+ max-line-length = 80
20
+ max-complexity = 12
21
+ ignore =
22
+ B950, E203, E501, W503, W291, W293, SIM905, PT004, PT005
23
+
24
+ # flake8-noqa config
25
+ noqa-require-code = true
26
+
27
+ # flake8-pytest-style config
28
+ pytest-fixture-no-parentheses = true
29
+ pytest-mark-no-parentheses = true
30
+
31
+ # I don't care about docstrings for test files or functions
32
+ per-file-ignores = tests/*.py : D
@@ -0,0 +1,2 @@
1
+ examples/** linguist-generated=true
2
+ stats_website/stats.md linguist-generated=true
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
7
+ - package-ecosystem: "pip"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "monthly"
@@ -0,0 +1,111 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches: main
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
14
+ PIP_DISABLE_PIP_VERSION_CHECK: 1
15
+ PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
16
+ TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817
17
+
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20
+ cancel-in-progress: true
21
+
22
+ jobs:
23
+ mypy:
24
+ name: Check code with mypy
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v3
28
+ - uses: actions/setup-python@v4
29
+ with:
30
+ cache: "pip"
31
+ cache-dependency-path: |
32
+ requirements-dev.txt
33
+ pyproject.toml
34
+ python-version: "3.10"
35
+ - name: Install wheel
36
+ run: pip install "wheel<1"
37
+ - name: Install requirements
38
+ run: |
39
+ pip install -r requirements-dev.txt
40
+ pip install -e .[everything]
41
+ - name: Run mypy on the project
42
+ run: mypy
43
+
44
+ flake8:
45
+ name: Lint code with flake8
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v3
49
+ - uses: actions/setup-python@v4
50
+ with:
51
+ cache: "pip"
52
+ cache-dependency-path: "requirements-dev.txt"
53
+ python-version: "3.10"
54
+ - name: Install wheel
55
+ run: pip install "wheel<1"
56
+ - name: Install requirements
57
+ run: pip install -r requirements-dev.txt
58
+ - name: lint the project
59
+ run: flake8
60
+
61
+ pytest-tests:
62
+ name: Run tests with pytest
63
+ runs-on: ${{ matrix.os }}
64
+ strategy:
65
+ matrix:
66
+ os: ["ubuntu-latest", "windows-latest", "macos-latest"]
67
+ python-version: ["3.10", "3.11"]
68
+ fail-fast: false
69
+
70
+ steps:
71
+ - uses: actions/checkout@v3
72
+ - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
73
+ uses: actions/setup-python@v4
74
+ with:
75
+ cache: "pip"
76
+ cache-dependency-path: |
77
+ requirements-dev.txt
78
+ pyproject.toml
79
+ python-version: ${{ matrix.python-version }}
80
+ - name: Install wheel
81
+ run: pip install "wheel<1"
82
+ - name: Install requirements
83
+ run: |
84
+ pip install -r requirements-dev.txt
85
+ pip install -e .[everything]
86
+ - name: Run tests under coverage
87
+ run: |
88
+ coverage run --branch --include=src/** -m pytest -m "not fails_inexplicably_in_ci"
89
+ coverage report --show-missing
90
+ - name: Upload coverage to coveralls
91
+ # Upload coverage if we are on the main repository and
92
+ # we're running on Linux (this action only supports Linux)
93
+ if: github.repository == 'AlexWaygood/typeshed-stats' && matrix.os == 'ubuntu-latest'
94
+ uses: AndreMiras/coveralls-python-action@develop
95
+ with:
96
+ github-token: ${{ secrets.GITHUB_TOKEN }}
97
+ parallel: true
98
+ flag-name: py${{ matrix.python-version }}-${{ matrix.os }}
99
+ debug: true
100
+
101
+ coveralls-finish:
102
+ needs: pytest-tests
103
+ if: github.repository == 'AlexWaygood/typeshed-stats'
104
+ runs-on: ubuntu-latest
105
+ steps:
106
+ - uses: actions/checkout@v3
107
+ - name: Send finished signal to Coveralls
108
+ uses: AndreMiras/coveralls-python-action@develop
109
+ with:
110
+ parallel-finished: true
111
+ debug: true
@@ -0,0 +1,32 @@
1
+ # Based on
2
+ # https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3
+
4
+ name: Publish Python distributions to PyPI
5
+
6
+ on: push
7
+
8
+ env:
9
+ PIP_DISABLE_PIP_VERSION_CHECK: 1
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ build-n-publish:
16
+ name: Build and publish Python distributions to PyPI
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Set up Python 3.10
21
+ uses: actions/setup-python@v4
22
+ with:
23
+ python-version: "3.10"
24
+ - name: Install pypa/build
25
+ run: pip install build --user
26
+ - name: Build a binary wheel and a source tarball
27
+ run: python -m build --sdist --wheel --outdir dist/ .
28
+ - name: Publish distribution to PyPI
29
+ if: startsWith(github.ref, 'refs/tags')
30
+ uses: pypa/gh-action-pypi-publish@release/v1
31
+ with:
32
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,65 @@
1
+ name: Regenerate examples and docs
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 */12 * * *"
6
+ push:
7
+ branches:
8
+ - main
9
+ paths:
10
+ - '.github/workflows/regen-examples-and-docs.yml'
11
+ - 'src/**'
12
+ - 'scripts/**'
13
+ workflow_dispatch:
14
+
15
+ env:
16
+ PIP_DISABLE_PIP_VERSION_CHECK: 1
17
+
18
+ jobs:
19
+ regen_examples_and_docs:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+ - name: git config
24
+ run: |
25
+ git config --global user.name statsabot
26
+ git config --global user.email ''
27
+ - uses: actions/setup-python@v4
28
+ with:
29
+ cache: "pip"
30
+ cache-dependency-path: |
31
+ requirements-dev.txt
32
+ pyproject.toml
33
+ python-version: "3.10"
34
+ - name: Install wheel
35
+ run: pip install "wheel<1"
36
+ - name: Install requirements
37
+ run: |
38
+ pip install -r requirements-dev.txt
39
+ pip install -e .[everything]
40
+ - name: Regenerate examples and docs
41
+ run: |
42
+ python scripts/regenerate_examples_and_docs.py --download-typeshed
43
+ git commit -a -m "Automated regeneration of examples and docs"
44
+ git push
45
+ - name: Deploy docs
46
+ run: mkdocs gh-deploy --force
47
+
48
+ create-issue-on-failure:
49
+ name: Create an issue if the automated regeneration failed
50
+ runs-on: ubuntu-latest
51
+ needs: [regen_examples_and_docs]
52
+ if: ${{ github.repository == 'AlexWaygood/typeshed-stats' && always() && github.event_name != 'workflow_dispatch' && (needs.regen_examples_and_docs.result == 'failure') }}
53
+ permissions:
54
+ issues: write
55
+ steps:
56
+ - uses: actions/github-script@v6
57
+ with:
58
+ github-token: ${{ secrets.GITHUB_TOKEN }}
59
+ script: |
60
+ await github.rest.issues.create({
61
+ owner: "AlexWaygood",
62
+ repo: "typeshed-stats",
63
+ title: `Automated regeneration of examples failed on ${new Date().toDateString()}`,
64
+ body: "Runs are listed here: https://github.com/AlexWaygood/typeshed-stats/actions/workflows/regen-examples-and-docs.yml",
65
+ })
@@ -0,0 +1,75 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ /env/
11
+ /build/
12
+ /develop-eggs/
13
+ /dist/
14
+ /downloads/
15
+ /eggs/
16
+ /lib/
17
+ /lib64/
18
+ /parts/
19
+ /sdist/
20
+ /var/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+
25
+ # PyInstaller
26
+ # Usually these files are written by a python script from a template
27
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
28
+ *.manifest
29
+ *.spec
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+ pip-delete-this-directory.txt
34
+
35
+ # Unit test / coverage reports
36
+ htmlcov/
37
+ .tox/
38
+ .coverage
39
+ .cache
40
+ nosetests.xml
41
+ coverage.xml
42
+ stubtest-output*
43
+
44
+ # Translations
45
+ *.mo
46
+ *.pot
47
+
48
+ # Django stuff:
49
+ *.log
50
+
51
+ # Sphinx documentation
52
+ docs/_build/
53
+
54
+ # PyBuilder
55
+ target/
56
+
57
+ # Local utility scripts
58
+ analyze.py
59
+
60
+ # Editor backup files
61
+ *~
62
+ .*.sw?
63
+ .vscode/
64
+ .idea/
65
+
66
+ # virtual environments
67
+ .venv*/
68
+ venv/
69
+ env/
70
+
71
+ # Mypy cache
72
+ .mypy_cache/
73
+
74
+ # mkdocs documentation
75
+ site/
@@ -0,0 +1,33 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.3.0 # must match requirements-dev.txt
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: requirements-txt-fixer
7
+ - repo: https://github.com/hadialqattan/pycln
8
+ rev: v2.1.2 # must match requirements-dev.txt
9
+ hooks:
10
+ - id: pycln
11
+ args: [--config=pyproject.toml, .]
12
+ - repo: https://github.com/asottile/pyupgrade
13
+ rev: v3.2.2
14
+ hooks:
15
+ - id: pyupgrade
16
+ args: [--py310-plus]
17
+ - repo: https://github.com/psf/black
18
+ rev: 22.10.0 # must match requirements-dev.txt
19
+ hooks:
20
+ - id: black
21
+ language_version: python3.10
22
+ - repo: https://github.com/pycqa/isort
23
+ rev: 5.10.1 # must match requirements-dev.txt
24
+ hooks:
25
+ - id: isort
26
+ name: isort (python)
27
+
28
+ ci:
29
+ autofix_commit_msg: '[pre-commit.ci] auto fixes from pre-commit.com hooks'
30
+ autofix_prs: true
31
+ autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
32
+ autoupdate_schedule: weekly
33
+ submodules: false
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.1
2
+ Name: typeshed_stats
3
+ Version: 22.11.0
4
+ Summary: Script to gather stats on the status of various typeshed packages
5
+ Project-URL: Homepage, https://github.com/AlexWaygood/typeshed-stats
6
+ Project-URL: Bug Tracker, https://github.com/AlexWaygood/typeshed-stats/issues
7
+ Author-email: Alex Waygood <alex.waygood@gmail.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: stubs,typeshed,typing
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: aiohttp[speedups]
23
+ Requires-Dist: attrs>=21.3.0
24
+ Requires-Dist: cattrs
25
+ Requires-Dist: packaging
26
+ Requires-Dist: tomli; python_version < '3.11'
27
+ Provides-Extra: everything
28
+ Requires-Dist: markdown; extra == 'everything'
29
+ Requires-Dist: rich; extra == 'everything'
30
+ Provides-Extra: html
31
+ Requires-Dist: markdown; extra == 'html'
32
+ Provides-Extra: rich
33
+ Requires-Dist: rich; extra == 'rich'
34
+ Description-Content-Type: text/markdown
35
+
36
+ <div align=center>
37
+
38
+ # typeshed-stats
39
+
40
+ A CLI tool and library to gather stats on typeshed
41
+
42
+ [![website](https://img.shields.io/website?down_color=red&down_message=Offline&style=for-the-badge&up_color=green&up_message=Running&url=https%3A%2F%2Falexwaygood.github.io%2Ftypeshed-stats%2F)](https://alexwaygood.github.io/typeshed-stats/)[![build status](https://img.shields.io/github/workflow/status/AlexWaygood/typeshed-stats/tests/main?label=Tests&style=for-the-badge)](https://github.com/AlexWaygood/typeshed-stats/actions/workflows/check.yml)[![Coveralls](https://img.shields.io/coveralls/github/AlexWaygood/typeshed-stats?style=for-the-badge)](https://coveralls.io/github/AlexWaygood/typeshed-stats)
43
+ <br>
44
+ [![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue?style=for-the-badge)](http://mypy-lang.org/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/psf/black)[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=for-the-badge&labelColor=ef8336)](https://pycqa.github.io/isort/)[![license](https://img.shields.io/github/license/AlexWaygood/typeshed-stats?style=for-the-badge)](https://opensource.org/licenses/MIT)
45
+
46
+ <hr>
47
+ <br>
48
+ </div>
49
+
50
+ ## What's this project for?
51
+
52
+ This project is for easy gathering of statistics relating to typeshed's stubs.
53
+
54
+ Some examples of things you can do from the command line:
55
+ - 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).
56
+ - 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`
57
+ - 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`
58
+
59
+ Example usage of the Python-level API:
60
+ ```python
61
+ from typeshed_stats.gather import tmpdir_typeshed, gather_stats
62
+
63
+ with tmpdir_typeshed() as typeshed:
64
+ stats = gather_stats(typeshed_dir=typeshed)
65
+ ```
66
+
67
+ ## How can I use this?
68
+
69
+ 1. Run `pip install git+https://github.com/AlexWaygood/typeshed-stats.git#egg=typeshed-stats[everything]` to install the package
70
+ 2. Run `typeshed-stats --help` for information about various options
71
+
72
+ ## Are there any examples of things this script can produce?
73
+ I'm glad you asked! They're in the `examples/` folder in this repo.
74
+ (These examples are generated using the `regenerate_examples.py` script in the repository root.)
75
+
76
+ ## How do I run tests/linters?
77
+ 1. Clone the repo and `cd` into it
78
+ 2. Create and activate a virtual environment
79
+ 3. Run `pip install -r requirements-dev.txt`
80
+ 4. Run `pip install -e .[everything]`
81
+ 5. Either run the linters/tests individually (see the `.github/workflows` directory for details about what's run in CI) or use the `runtests.py` convenience script to run them all in succession.
@@ -0,0 +1,46 @@
1
+ <div align=center>
2
+
3
+ # typeshed-stats
4
+
5
+ A CLI tool and library to gather stats on typeshed
6
+
7
+ [![website](https://img.shields.io/website?down_color=red&down_message=Offline&style=for-the-badge&up_color=green&up_message=Running&url=https%3A%2F%2Falexwaygood.github.io%2Ftypeshed-stats%2F)](https://alexwaygood.github.io/typeshed-stats/)[![build status](https://img.shields.io/github/workflow/status/AlexWaygood/typeshed-stats/tests/main?label=Tests&style=for-the-badge)](https://github.com/AlexWaygood/typeshed-stats/actions/workflows/check.yml)[![Coveralls](https://img.shields.io/coveralls/github/AlexWaygood/typeshed-stats?style=for-the-badge)](https://coveralls.io/github/AlexWaygood/typeshed-stats)
8
+ <br>
9
+ [![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue?style=for-the-badge)](http://mypy-lang.org/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/psf/black)[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=for-the-badge&labelColor=ef8336)](https://pycqa.github.io/isort/)[![license](https://img.shields.io/github/license/AlexWaygood/typeshed-stats?style=for-the-badge)](https://opensource.org/licenses/MIT)
10
+
11
+ <hr>
12
+ <br>
13
+ </div>
14
+
15
+ ## What's this project for?
16
+
17
+ This project is for easy gathering of statistics relating to typeshed's stubs.
18
+
19
+ Some examples of things you can do from the command line:
20
+ - 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).
21
+ - 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`
22
+ - 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`
23
+
24
+ Example usage of the Python-level API:
25
+ ```python
26
+ from typeshed_stats.gather import tmpdir_typeshed, gather_stats
27
+
28
+ with tmpdir_typeshed() as typeshed:
29
+ stats = gather_stats(typeshed_dir=typeshed)
30
+ ```
31
+
32
+ ## How can I use this?
33
+
34
+ 1. Run `pip install git+https://github.com/AlexWaygood/typeshed-stats.git#egg=typeshed-stats[everything]` to install the package
35
+ 2. Run `typeshed-stats --help` for information about various options
36
+
37
+ ## Are there any examples of things this script can produce?
38
+ I'm glad you asked! They're in the `examples/` folder in this repo.
39
+ (These examples are generated using the `regenerate_examples.py` script in the repository root.)
40
+
41
+ ## How do I run tests/linters?
42
+ 1. Clone the repo and `cd` into it
43
+ 2. Create and activate a virtual environment
44
+ 3. Run `pip install -r requirements-dev.txt`
45
+ 4. Run `pip install -e .[everything]`
46
+ 5. Either run the linters/tests individually (see the `.github/workflows` directory for details about what's run in CI) or use the `runtests.py` convenience script to run them all in succession.