diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24d9fa8f3..102199c8a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ On Linux and Mac OS, you will be able to run the full test suite on Python 3.8, To install the necessary requirements, run the following commands from a terminal window: -``` +```bash $ python3 -m venv .venv $ source .venv/bin/activate (.venv)$ pip install -U pip @@ -73,11 +73,11 @@ WSL, follow the Linux/Mac OS instructions above. If you do not wish to install WSL, run the following commands from a Windows terminal to install all non-pytype requirements: -``` +```powershell > python -m venv .venv -> ".venv/scripts/activate" +> .venv\scripts\activate (.venv) > pip install -U pip -(.venv) > pip install -r requirements-tests.txt +(.venv) > pip install -r "requirements-tests.txt" ``` ## Code formatting @@ -93,10 +93,10 @@ right away and add a commit to your PR. That being said, if you *want* to run the checks locally when you commit, you're free to do so. Either run `pycln`, `black` and `isort` manually... -``` -pycln --config=pyproject.toml . -isort . -black . +```bash +$ pycln --config=pyproject.toml . +$ isort . +$ black . ``` ...Or install the pre-commit hooks: please refer to the @@ -107,8 +107,8 @@ Our code is also linted using `flake8`, with plugins `flake8-pyi`, flake8 before filing a PR is not required. However, if you wish to run flake8 locally, install the test dependencies as outlined above, and then run: -``` -flake8 . +```bash +(.venv3)$ flake8 . ``` ## Where to make changes @@ -248,7 +248,7 @@ To get started, fork typeshed, clone your fork, and then You can then install the library with `pip` into the virtualenv and run the script, replacing `libraryname` with the name of the library below: -``` +```bash (.venv3)$ pip install libraryname (.venv3)$ python3 scripts/create_baseline_stubs.py libraryname ``` diff --git a/tests/README.md b/tests/README.md index 994ef4d3e..4c526becb 100644 --- a/tests/README.md +++ b/tests/README.md @@ -22,7 +22,7 @@ in the `CONTRIBUTING.md` document. In particular, we recommend running with Pyth ## Run all tests for a specific stub Run using: -``` +```bash (.venv3)$ python3 scripts/runtests.py / ``` @@ -36,7 +36,7 @@ so: `stdlib/os` or `stubs/requests`. ## mypy\_test.py Run using: -``` +```bash (.venv3)$ python3 tests/mypy_test.py ``` @@ -56,7 +56,7 @@ Note: this test cannot be run on Windows systems unless you are using Windows Subsystem for Linux. Run using: -``` +```bash (.venv3)$ python3 tests/pytype_test.py ``` @@ -67,7 +67,7 @@ This test works similarly to `mypy_test.py`, except it uses `pytype`. This test requires [Node.js](https://nodejs.org) to be installed. Although typeshed runs pyright in CI, it does not currently use this script. However, this script uses the same pyright version and configuration as the CI. -``` +```bash (.venv3)$ python3 tests/pyright_test.py # Check all files (.venv3)$ python3 tests/pyright_test.py stdlib/sys.pyi # Check one file (.venv3)$ python3 tests/pyright_test.py -p pyrightconfig.stricter.json # Check with the stricter config. @@ -88,14 +88,14 @@ for information on the various configuration options. ## check\_consistent.py Run using: -``` -python3 tests/check_consistent.py +```bash +$ python3 tests/check_consistent.py ``` ## stubtest\_stdlib.py Run using -``` +```bash (.venv3)$ python3 tests/stubtest_stdlib.py ``` @@ -124,7 +124,7 @@ this script locally if you know you can trust the packages you're running stubtest on. Run using -``` +```bash (.venv3)$ python3 tests/stubtest_third_party.py ``` @@ -132,13 +132,13 @@ Similar to `stubtest_stdlib.py`, but tests the third party stubs. By default, it checks all third-party stubs, but you can provide the distributions to check on the command line: -``` +```bash (.venv3)$ python3 tests/stubtest_third_party.py Pillow toml # check stubs/Pillow and stubs/toml ``` If you have the runtime package installed in your local virtual environment, you can also run stubtest directly, with -``` +```bash (.venv3)$ MYPYPATH= python3 -m mypy.stubtest \ --custom-typeshed-dir \ @@ -173,7 +173,7 @@ for missing objects rather than trying to match the runtime in every detail. ## typecheck\_typeshed.py Run using -``` +```bash (.venv3)$ python3 tests/typecheck_typeshed.py ```