Clarify requires-python inference requirements (#4918)

This commit is contained in:
Charlie Marsh
2023-06-07 00:18:56 -04:00
committed by GitHub
parent b9060ea2bd
commit ec609f5c3b
2 changed files with 7 additions and 6 deletions

View File

@@ -436,12 +436,13 @@ pub struct Options {
target-version = "py37"
"#
)]
/// The Python version to target, e.g., when considering automatic code
/// upgrades, like rewriting type annotations.
/// The minimum Python version to target, e.g., when considering automatic
/// code upgrades, like rewriting type annotations.
///
/// If omitted, the target version will be inferred from the
/// `project.requires-python` field in the relevant `pyproject.toml`
/// (e.g., `requires-python = ">=3.8"`), if present.
/// If 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.
pub target_version: Option<PythonVersion>,
#[option(
default = r#"["TODO", "FIXME", "XXX"]"#,

2
ruff.schema.json generated
View File

@@ -528,7 +528,7 @@
]
},
"target-version": {
"description": "The Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations.\n\nIf omitted, the target version will be inferred from the `project.requires-python` field in the relevant `pyproject.toml` (e.g., `requires-python = \">=3.8\"`), if present.",
"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.",
"anyOf": [
{
"$ref": "#/definitions/PythonVersion"