[ty] document the `"all"` option for `python-platform` (#18548)

Co-authored-by: detachhead <detachhead@users.noreply.github.com>
This commit is contained in:
DetachHead 2025-06-09 22:01:24 +10:00 committed by GitHub
parent b01c95d460
commit 07cb84426d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -76,6 +76,7 @@ python = "./.venv"
Specifies the target platform that will be used to analyze the source code.
If specified, ty will understand conditions based on comparisons with `sys.platform`, such
as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
If `all` is specified, ty will assume that the source code can run on any platform.
If no platform is specified, ty will use the current platform:
- `win32` for Windows
@ -86,7 +87,7 @@ If no platform is specified, ty will use the current platform:
**Default value**: `<current-platform>`
**Type**: `"win32" | "darwin" | "android" | "ios" | "linux" | str`
**Type**: `"win32" | "darwin" | "android" | "ios" | "linux" | "all" | str`
**Example usage** (`pyproject.toml`):

View File

@ -333,6 +333,7 @@ pub struct EnvironmentOptions {
/// Specifies the target platform that will be used to analyze the source code.
/// If specified, ty will understand conditions based on comparisons with `sys.platform`, such
/// as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.
/// If `all` is specified, ty will assume that the source code can run on any platform.
///
/// If no platform is specified, ty will use the current platform:
/// - `win32` for Windows
@ -343,7 +344,7 @@ pub struct EnvironmentOptions {
#[serde(skip_serializing_if = "Option::is_none")]
#[option(
default = r#"<current-platform>"#,
value_type = r#""win32" | "darwin" | "android" | "ios" | "linux" | str"#,
value_type = r#""win32" | "darwin" | "android" | "ios" | "linux" | "all" | str"#,
example = r#"
# Tailor type stubs and conditionalized type definitions to windows.
python-platform = "win32"

2
ty.schema.json generated
View File

@ -88,7 +88,7 @@
]
},
"python-platform": {
"description": "Specifies the target platform that will be used to analyze the source code. If specified, ty will understand conditions based on comparisons with `sys.platform`, such as are commonly found in typeshed to reflect the differing contents of the standard library across platforms.\n\nIf no platform is specified, ty will use the current platform: - `win32` for Windows - `darwin` for macOS - `android` for Android - `ios` for iOS - `linux` for everything else",
"description": "Specifies the target platform that will be used to analyze the source code. If specified, ty will understand conditions based on comparisons with `sys.platform`, such as are commonly found in typeshed to reflect the differing contents of the standard library across platforms. If `all` is specified, ty will assume that the source code can run on any platform.\n\nIf no platform is specified, ty will use the current platform: - `win32` for Windows - `darwin` for macOS - `android` for Android - `ios` for iOS - `linux` for everything else",
"anyOf": [
{
"$ref": "#/definitions/PythonPlatform"