mirror of
https://github.com/astral-sh/ty.git
synced 2026-05-06 08:56:48 -04:00
Minor updates to the docs (#1919)
## Summary I did a full review of all docs using Claude, and these seemed worth fixing.
This commit is contained in:
@@ -42,6 +42,6 @@ Install ty into your current Python environment with pip:
|
||||
pip install ty
|
||||
```
|
||||
|
||||
## Adding ty¸to your editor
|
||||
## Adding ty to your editor
|
||||
|
||||
See the [editors](./editors.md) page to add ty to your editor.
|
||||
|
||||
@@ -35,7 +35,7 @@ configured or detected, ty will try to infer the Python version being used from
|
||||
environment's metadata.
|
||||
|
||||
If no virtual environment is present or inferring the Python version from the metadata fails,
|
||||
ty will fall back to the latest stable Python version supported by ty (currently 3.13).
|
||||
ty will fall back to the latest stable Python version supported by ty (currently 3.14).
|
||||
|
||||
The Python version may also be explicitly specified using the
|
||||
[`python-version`](./reference/configuration.md#python-version) setting or the
|
||||
|
||||
+9
-9
@@ -19,18 +19,18 @@ Rule violations spanning multiple lines can be suppressed by adding the comment
|
||||
violation's first or last line:
|
||||
|
||||
```py
|
||||
def add_three(a: int, b: int, c: int): ...
|
||||
def sum_three_numbers(a: int, b: int, c: int) -> int: ...
|
||||
|
||||
# on the first line
|
||||
|
||||
add_three( # ty: ignore[missing-argument]
|
||||
sum_three_numbers( # ty: ignore[missing-argument]
|
||||
3,
|
||||
2
|
||||
)
|
||||
|
||||
# or, on the last line
|
||||
|
||||
add_three(
|
||||
sum_three_numbers(
|
||||
3,
|
||||
2
|
||||
) # ty: ignore[missing-argument]
|
||||
@@ -39,7 +39,7 @@ add_three(
|
||||
To suppress multiple violations on a single line, enumerate each rule separated by a comma:
|
||||
|
||||
```python
|
||||
add_three("one", 5) # ty: ignore[missing-argument, invalid-argument-type]
|
||||
sum_three_numbers("one", 5) # ty: ignore[missing-argument, invalid-argument-type]
|
||||
```
|
||||
|
||||
!!! note
|
||||
@@ -49,7 +49,7 @@ add_three("one", 5) # ty: ignore[missing-argument, invalid-argument-type]
|
||||
|
||||
## Standard suppression comments
|
||||
|
||||
ty supports the standard [`type:ignore`](https://typing.python.org/en/latest/spec/directives.html#type-ignore-comments) comment
|
||||
ty supports the standard [`type: ignore`](https://typing.python.org/en/latest/spec/directives.html#type-ignore-comments) comment
|
||||
format introduced by PEP 484.
|
||||
|
||||
ty handles these similarly to `ty: ignore` comments, but suppresses all violations on that line,
|
||||
@@ -57,7 +57,7 @@ even when `type: ignore[code]` is used.
|
||||
|
||||
```python
|
||||
# Ignore all typing errors on the next line
|
||||
add_three("one", 5) # type: ignore
|
||||
sum_three_numbers("one", 5) # type: ignore
|
||||
```
|
||||
|
||||
## Multiple suppressions comments
|
||||
@@ -91,12 +91,12 @@ to suppress all violations inside a function.
|
||||
```python
|
||||
from typing import no_type_check
|
||||
|
||||
def add_three(a: int, b: int, c: int):
|
||||
a + b + c
|
||||
def sum_three_numbers(a: int, b: int, c: int) -> int:
|
||||
return a + b + c
|
||||
|
||||
@no_type_check
|
||||
def main():
|
||||
add_three(3, 4)
|
||||
sum_three_numbers(1, 2) # no error for the missing argument
|
||||
```
|
||||
|
||||
Decorating a class with `@no_type_check` isn't supported.
|
||||
|
||||
@@ -24,9 +24,9 @@ See the [module discovery](./modules.md) documentation for details.
|
||||
|
||||
## File selection
|
||||
|
||||
ty will run on all Python files in the working directory and or subdirectories. If used from a
|
||||
project, ty will run on all Python files in the project (starting in the directory with the
|
||||
`pyproject.toml`).
|
||||
ty will run on all Python files in the working directory (including subdirectories, recursively).
|
||||
If used from a project, ty will run on all Python files in the project (starting in the directory
|
||||
with the `pyproject.toml`).
|
||||
|
||||
You can also provide specific paths to check:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user