Extend target-version documentation (#6482)

Closes https://github.com/astral-sh/ruff/issues/6462
This commit is contained in:
Zanie Blue
2023-08-10 12:11:37 -05:00
committed by GitHub
parent 6706ae4828
commit 1050c4e104
2 changed files with 6 additions and 2 deletions

View File

@@ -464,7 +464,11 @@ pub struct Options {
"#
)]
/// The minimum Python version to target, e.g., when considering automatic
/// code upgrades, like rewriting type annotations.
/// code upgrades, like rewriting type annotations. Ruff will not propose
/// changes using features that are not available in the given version.
///
/// For example, to represent supporting Python >=3.10 or ==3.10
/// specify `target-version = "py310"`.
///
/// If omitted, and Ruff is configured via a `pyproject.toml` file, the
/// target version will be inferred from its `project.requires-python`

2
ruff.schema.json generated
View File

@@ -560,7 +560,7 @@
]
},
"target-version": {
"description": "The minimum Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations.\n\nIf omitted, and Ruff is configured via a `pyproject.toml` file, the target version will be inferred from its `project.requires-python` field (e.g., `requires-python = \">=3.8\"`). If Ruff is configured via `ruff.toml` or `.ruff.toml`, no such inference will be performed.",
"description": "The minimum Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations. Ruff will not propose changes using features that are not available in the given version.\n\nFor example, to represent supporting Python >=3.10 or ==3.10 specify `target-version = \"py310\"`.\n\nIf omitted, and Ruff is configured via a `pyproject.toml` file, the target version will be inferred from its `project.requires-python` field (e.g., `requires-python = \">=3.8\"`). If Ruff is configured via `ruff.toml` or `.ruff.toml`, no such inference will be performed.",
"anyOf": [
{
"$ref": "#/definitions/PythonVersion"