From bc7b30364dcd196f9d660218b852870b1d978e76 Mon Sep 17 00:00:00 2001 From: Rogdham <3994389+Rogdham@users.noreply.github.com> Date: Sun, 11 May 2025 18:25:54 +0200 Subject: [PATCH] python_stdlib: update for 3.14 (#18014) ## Summary Added version 3.14 to the script generating the `known_stdlib.rs` file. Rebuilt the known stdlibs with latest version (2025.5.10) of [stdlibs Python lib](https://pypi.org/project/stdlibs/) (which added support for 3.14.0b1). _Note: Python 3.14 is now in [feature freeze](https://peps.python.org/pep-0745/) so the modules in stdlib should be stable._ _See also: #15506_ ## Test Plan The following command has been run. Using for tests the `compression` module which been introduced with Python 3.14. ```sh ruff check --no-cache --select I001 --target-version py314 --fix ``` With ruff 0.11.9: ```python import base64 import datetime import compression print(base64, compression, datetime) ``` With this PR: ```python import base64 import compression import datetime print(base64, compression, datetime) ``` --- .../src/sys/known_stdlib.rs | 54 ++++++++++++++++++- scripts/generate_known_standard_library.py | 1 + 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/crates/ruff_python_stdlib/src/sys/known_stdlib.rs b/crates/ruff_python_stdlib/src/sys/known_stdlib.rs index 7c08ebe800..4ab64366fc 100644 --- a/crates/ruff_python_stdlib/src/sys/known_stdlib.rs +++ b/crates/ruff_python_stdlib/src/sys/known_stdlib.rs @@ -23,7 +23,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "_collections" | "_collections_abc" | "_compat_pickle" - | "_compression" | "_contextvars" | "_csv" | "_ctypes" @@ -285,6 +284,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { ) | ( 7, "_bootlocale" + | "_compression" | "_crypt" | "_dummy_thread" | "_msi" @@ -324,6 +324,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { ) | ( 8, "_bootlocale" + | "_compression" | "_crypt" | "_dummy_thread" | "_msi" @@ -368,6 +369,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { "_aix_support" | "_bootlocale" | "_bootsubprocess" + | "_compression" | "_crypt" | "_msi" | "_peg_parser" @@ -399,7 +401,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "nntplib" | "ossaudiodev" | "parser" - | "peg_parser" | "pipes" | "smtpd" | "sndhdr" @@ -414,6 +415,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { 10, "_aix_support" | "_bootsubprocess" + | "_compression" | "_crypt" | "_msi" | "_posixshmem" @@ -460,6 +462,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "__phello_alias__" | "_aix_support" | "_bootsubprocess" + | "_compression" | "_crypt" | "_msi" | "_posixshmem" @@ -507,6 +510,7 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "__hello_only__" | "__phello_alias__" | "_aix_support" + | "_compression" | "_crypt" | "_msi" | "_posixshmem" @@ -554,7 +558,9 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "__phello_alias__" | "_aix_support" | "_android_support" + | "_apple_support" | "_colorize" + | "_compression" | "_interpchannels" | "_interpqueues" | "_interpreters" @@ -583,6 +589,50 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool { | "tomllib" | "xxlimited_35" | "zoneinfo" + ) | ( + 14, + "__hello_alias__" + | "__hello_only__" + | "__phello_alias__" + | "_aix_support" + | "_android_support" + | "_apple_support" + | "_ast_unparse" + | "_colorize" + | "_hmac" + | "_interpchannels" + | "_interpqueues" + | "_interpreters" + | "_ios_support" + | "_opcode_metadata" + | "_posixshmem" + | "_py_warnings" + | "_pydatetime" + | "_pylong" + | "_pyrepl" + | "_remote_debugging" + | "_sha2" + | "_statistics" + | "_suggestions" + | "_sysconfig" + | "_testcapi_datetime" + | "_testclinic" + | "_testclinic_limited" + | "_testinternalcapi" + | "_testlimitedcapi" + | "_testsinglephase" + | "_tokenize" + | "_types" + | "_typing" + | "_wmi" + | "_zoneinfo" + | "_zstd" + | "annotationlib" + | "compression" + | "graphlib" + | "tomllib" + | "xxlimited_35" + | "zoneinfo" ) ) } diff --git a/scripts/generate_known_standard_library.py b/scripts/generate_known_standard_library.py index 22117b60d4..84355af82a 100644 --- a/scripts/generate_known_standard_library.py +++ b/scripts/generate_known_standard_library.py @@ -13,6 +13,7 @@ VERSIONS: list[tuple[int, int]] = [ (3, 11), (3, 12), (3, 13), + (3, 14), ] with PATH.open("w") as f: