Skip to content

Commit d2154f5

Browse files
authored
Style and formatting docs fixes (#15299)
* Add PEP links for more context * Normalize the virtualenv name from `.venv3` to `.venv` (the [documentation suggests](https://github.com/python/typeshed/blob/main/CONTRIBUTING.md#-or-create-a-local-development-environment) creating a `.venv` name, not `.venv3`so `venv3` is not used anywhere else)
1 parent b94c9e8 commit d2154f5

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,20 +344,20 @@ the latest mypy (`pip install -r requirements-tests.txt`) before running the scr
344344

345345
### Supported type system features
346346

347-
Since PEP 484 was accepted, there have been many other PEPs that added
348-
new features to the Python type system. In general, new features can
349-
be used in typeshed as soon as the PEP has been accepted and implemented
350-
and most type checkers support the new feature.
347+
Since [PEP 484](https://peps.python.org/pep-0484/) was accepted, there have been
348+
many other PEPs that added new features to the Python type system. In general,
349+
new features can be used in typeshed as soon as the PEP has been accepted and
350+
implemented and most type checkers support the new feature.
351351

352352
Supported features include:
353-
- [PEP 544](https://peps.python.org/pep-0544/) (Protocol)
353+
- [PEP 544](https://peps.python.org/pep-0544/) (`Protocol`)
354354
- [PEP 585](https://peps.python.org/pep-0585/) (builtin generics)
355-
- [PEP 586](https://peps.python.org/pep-0586/) (Literal)
356-
- [PEP 591](https://peps.python.org/pep-0591/) (Final/@final)
357-
- [PEP 589](https://peps.python.org/pep-0589/) (TypedDict)
355+
- [PEP 586](https://peps.python.org/pep-0586/) (`Literal`)
356+
- [PEP 591](https://peps.python.org/pep-0591/) (`Final`/`@final`)
357+
- [PEP 589](https://peps.python.org/pep-0589/) (`TypedDict`)
358358
- [PEP 604](https://peps.python.org/pep-0604/) (`Foo | Bar` union syntax)
359-
- [PEP 612](https://peps.python.org/pep-0612/) (ParamSpec)
360-
- [PEP 647](https://peps.python.org/pep-0647/) (TypeGuard):
359+
- [PEP 612](https://peps.python.org/pep-0612/) (`ParamSpec`)
360+
- [PEP 647](https://peps.python.org/pep-0647/) (`TypeGuard`):
361361
see [#5406](https://github.com/python/typeshed/issues/5406)
362362
- [PEP 655](https://peps.python.org/pep-0655/) (`Required` and `NotRequired`)
363363
- [PEP 673](https://peps.python.org/pep-0673/) (`Self`)

tests/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ may require extra dependencies external to typeshed to be installed in your virt
2222
prior to running the test.
2323
You can list or install all of a stubs package's external dependencies using the following script:
2424
```bash
25-
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub> # List external dependencies for <third_party_stub>
26-
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub1> <third_party_stub2> # List external dependencies for <third_party_stub1> and <third_party_stub2>
27-
(.venv3)$ python tests/get_external_stub_requirements.py # List external dependencies for all third-party stubs in typeshed
28-
(.venv3)$ python scripts/install_all_third_party_dependencies.py # Install external dependencies for all third-party stubs in typeshed
25+
(.venv)$ python tests/get_external_stub_requirements.py <third_party_stub> # List external dependencies for <third_party_stub>
26+
(.venv)$ python tests/get_external_stub_requirements.py <third_party_stub1> <third_party_stub2> # List external dependencies for <third_party_stub1> and <third_party_stub2>
27+
(.venv)$ python tests/get_external_stub_requirements.py # List external dependencies for all third-party stubs in typeshed
28+
(.venv)$ python scripts/install_all_third_party_dependencies.py # Install external dependencies for all third-party stubs in typeshed
2929
```
3030

3131
## Run all tests for a specific stub
3232

3333
Run using:
3434
```bash
35-
(.venv3)$ python3 tests/runtests.py <stdlib-or-stubs>/<stub-to-test>
35+
(.venv)$ python3 tests/runtests.py <stdlib-or-stubs>/<stub-to-test>
3636
```
3737

3838
This script will run all tests below for a specific typeshed directory. If a
@@ -52,7 +52,7 @@ For more information, see the docs on [`stubtest_stdlib.py`](#stubtest_stdlibpy)
5252

5353
Run using:
5454
```bash
55-
(.venv3)$ python3 tests/mypy_test.py
55+
(.venv)$ python3 tests/mypy_test.py
5656
```
5757

5858
The test has two parts: running mypy on the stdlib stubs,
@@ -71,9 +71,9 @@ This test requires [Node.js](https://nodejs.org) to be installed. Although
7171
typeshed runs pyright in CI, it does not currently use this script. However,
7272
this script uses the same pyright version and configuration as the CI.
7373
```bash
74-
(.venv3)$ python3 tests/pyright_test.py # Check all files
75-
(.venv3)$ python3 tests/pyright_test.py stdlib/sys.pyi # Check one file
76-
(.venv3)$ python3 tests/pyright_test.py -p pyrightconfig.stricter.json # Check with the stricter config.
74+
(.venv)$ python3 tests/pyright_test.py # Check all files
75+
(.venv)$ python3 tests/pyright_test.py stdlib/sys.pyi # Check one file
76+
(.venv)$ python3 tests/pyright_test.py -p pyrightconfig.stricter.json # Check with the stricter config.
7777
```
7878

7979
`pyrightconfig.stricter.json` is a stricter configuration that enables additional
@@ -103,7 +103,7 @@ $ python3 tests/check_typeshed_structure.py
103103

104104
Run using
105105
```bash
106-
(.venv3)$ python3 tests/stubtest_stdlib.py
106+
(.venv)$ python3 tests/stubtest_stdlib.py
107107
```
108108

109109
This test compares the stdlib stubs against the objects at runtime. Because of
@@ -138,21 +138,21 @@ stubtest on.
138138

139139
Run using
140140
```bash
141-
(.venv3)$ python3 tests/stubtest_third_party.py
141+
(.venv)$ python3 tests/stubtest_third_party.py
142142
```
143143

144144
Similar to `stubtest_stdlib.py`, but tests the third party stubs. By default,
145145
it checks all third-party stubs, but you can provide the distributions to
146146
check on the command line:
147147

148148
```bash
149-
(.venv3)$ python3 tests/stubtest_third_party.py requests toml # check stubs/requests and stubs/toml
149+
(.venv)$ python3 tests/stubtest_third_party.py requests toml # check stubs/requests and stubs/toml
150150
```
151151

152152
If you have the runtime package installed in your local virtual environment, you can also run stubtest
153153
directly, with
154154
```bash
155-
(.venv3)$ MYPYPATH=<path-to-module-stubs> python3 -m mypy.stubtest \
155+
(.venv)$ MYPYPATH=<path-to-module-stubs> python3 -m mypy.stubtest \
156156
--custom-typeshed-dir <path-to-typeshed> \
157157
<third-party-module>
158158
```
@@ -203,7 +203,7 @@ configuration to properly validate Django-specific types during stubtest executi
203203

204204
Run using
205205
```bash
206-
(.venv3)$ python3 tests/typecheck_typeshed.py
206+
(.venv)$ python3 tests/typecheck_typeshed.py
207207
```
208208

209209
This is a small wrapper script that uses mypy to typecheck typeshed's own code in the

tests/REGRESSION.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ rather than `.pyi` files)
9999
is that the test cases cannot always use modern syntax for type hints.
100100
While we can use `from __future__ import annotations` to enable the use of
101101
modern typing syntax wherever possible,
102-
type checkers may (correctly) emit errors if PEP 604 syntax or PEP 585 syntax
103-
is used in a runtime context on lower versions of Python. For example:
102+
type checkers may (correctly) emit errors if [PEP 604](https://peps.python.org/pep-0604/)
103+
syntax or [PEP 585](https://peps.python.org/pep-0585/) syntax is used
104+
in a runtime context on lower versions of Python. For example:
104105

105106
```python
106107
from __future__ import annotations

0 commit comments

Comments
 (0)