Add Python 3.13 to list of allowed Python versions (#11411)

## Summary

I believe we're already "Python 3.13-ready"? The main Ruff-impacting
change I see in https://docs.python.org/3.13/whatsnew/3.13.html is [PEP
696](https://peps.python.org/pep-0696/) which Jelle added in
https://github.com/astral-sh/ruff/pull/11120.
This commit is contained in:
Charlie Marsh 2024-05-13 12:35:41 -04:00 committed by GitHub
parent dc5c44ccc4
commit 6ed2482e27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 170 additions and 25 deletions

View File

@ -49,6 +49,7 @@ pub enum PythonVersion {
Py310, Py310,
Py311, Py311,
Py312, Py312,
Py313,
} }
impl From<PythonVersion> for Pep440Version { impl From<PythonVersion> for Pep440Version {
@ -72,6 +73,7 @@ impl PythonVersion {
Self::Py310 => (3, 10), Self::Py310 => (3, 10),
Self::Py311 => (3, 11), Self::Py311 => (3, 11),
Self::Py312 => (3, 12), Self::Py312 => (3, 12),
Self::Py313 => (3, 13),
} }
} }

View File

@ -465,6 +465,7 @@ pub enum PythonVersion {
Py310, Py310,
Py311, Py311,
Py312, Py312,
Py313,
} }
impl PythonVersion { impl PythonVersion {

View File

@ -25,7 +25,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_compat_pickle" | "_compat_pickle"
| "_compression" | "_compression"
| "_contextvars" | "_contextvars"
| "_crypt"
| "_csv" | "_csv"
| "_ctypes" | "_ctypes"
| "_ctypes_test" | "_ctypes_test"
@ -49,7 +48,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_lzma" | "_lzma"
| "_markupbase" | "_markupbase"
| "_md5" | "_md5"
| "_msi"
| "_multibytecodec" | "_multibytecodec"
| "_multiprocessing" | "_multiprocessing"
| "_opcode" | "_opcode"
@ -93,14 +91,12 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_winapi" | "_winapi"
| "_xxtestfuzz" | "_xxtestfuzz"
| "abc" | "abc"
| "aifc"
| "antigravity" | "antigravity"
| "argparse" | "argparse"
| "array" | "array"
| "ast" | "ast"
| "asyncio" | "asyncio"
| "atexit" | "atexit"
| "audioop"
| "base64" | "base64"
| "bdb" | "bdb"
| "binascii" | "binascii"
@ -109,9 +105,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "bz2" | "bz2"
| "cProfile" | "cProfile"
| "calendar" | "calendar"
| "cgi"
| "cgitb"
| "chunk"
| "cmath" | "cmath"
| "cmd" | "cmd"
| "code" | "code"
@ -126,7 +119,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "contextvars" | "contextvars"
| "copy" | "copy"
| "copyreg" | "copyreg"
| "crypt"
| "csv" | "csv"
| "ctypes" | "ctypes"
| "curses" | "curses"
@ -165,7 +157,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "http" | "http"
| "idlelib" | "idlelib"
| "imaplib" | "imaplib"
| "imghdr"
| "importlib" | "importlib"
| "inspect" | "inspect"
| "io" | "io"
@ -173,24 +164,19 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "itertools" | "itertools"
| "json" | "json"
| "keyword" | "keyword"
| "lib2to3"
| "linecache" | "linecache"
| "locale" | "locale"
| "logging" | "logging"
| "lzma" | "lzma"
| "mailbox" | "mailbox"
| "mailcap"
| "marshal" | "marshal"
| "math" | "math"
| "mimetypes" | "mimetypes"
| "mmap" | "mmap"
| "modulefinder" | "modulefinder"
| "msilib"
| "msvcrt" | "msvcrt"
| "multiprocessing" | "multiprocessing"
| "netrc" | "netrc"
| "nis"
| "nntplib"
| "nt" | "nt"
| "ntpath" | "ntpath"
| "nturl2path" | "nturl2path"
@ -199,12 +185,10 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "operator" | "operator"
| "optparse" | "optparse"
| "os" | "os"
| "ossaudiodev"
| "pathlib" | "pathlib"
| "pdb" | "pdb"
| "pickle" | "pickle"
| "pickletools" | "pickletools"
| "pipes"
| "pkgutil" | "pkgutil"
| "platform" | "platform"
| "plistlib" | "plistlib"
@ -240,10 +224,8 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "signal" | "signal"
| "site" | "site"
| "smtplib" | "smtplib"
| "sndhdr"
| "socket" | "socket"
| "socketserver" | "socketserver"
| "spwd"
| "sqlite3" | "sqlite3"
| "sre_compile" | "sre_compile"
| "sre_constants" | "sre_constants"
@ -255,14 +237,12 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "stringprep" | "stringprep"
| "struct" | "struct"
| "subprocess" | "subprocess"
| "sunau"
| "symtable" | "symtable"
| "sys" | "sys"
| "sysconfig" | "sysconfig"
| "syslog" | "syslog"
| "tabnanny" | "tabnanny"
| "tarfile" | "tarfile"
| "telnetlib"
| "tempfile" | "tempfile"
| "termios" | "termios"
| "textwrap" | "textwrap"
@ -284,7 +264,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "unicodedata" | "unicodedata"
| "unittest" | "unittest"
| "urllib" | "urllib"
| "uu"
| "uuid" | "uuid"
| "venv" | "venv"
| "warnings" | "warnings"
@ -294,7 +273,6 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "winreg" | "winreg"
| "winsound" | "winsound"
| "wsgiref" | "wsgiref"
| "xdrlib"
| "xml" | "xml"
| "xmlrpc" | "xmlrpc"
| "xx" | "xx"
@ -307,45 +285,91 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
) | ( ) | (
7, 7,
"_bootlocale" "_bootlocale"
| "_crypt"
| "_dummy_thread" | "_dummy_thread"
| "_msi"
| "_sha256" | "_sha256"
| "_sha512" | "_sha512"
| "aifc"
| "asynchat" | "asynchat"
| "asyncore" | "asyncore"
| "audioop"
| "binhex" | "binhex"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "distutils" | "distutils"
| "dummy_threading" | "dummy_threading"
| "formatter" | "formatter"
| "imghdr"
| "imp" | "imp"
| "lib2to3"
| "macpath" | "macpath"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "parser" | "parser"
| "pipes"
| "smtpd" | "smtpd"
| "sndhdr"
| "spwd"
| "sunau"
| "symbol" | "symbol"
| "telnetlib"
| "uu"
| "xdrlib"
) | ( ) | (
8, 8,
"_bootlocale" "_bootlocale"
| "_crypt"
| "_dummy_thread" | "_dummy_thread"
| "_msi"
| "_posixshmem" | "_posixshmem"
| "_sha256" | "_sha256"
| "_sha512" | "_sha512"
| "_statistics" | "_statistics"
| "_testinternalcapi" | "_testinternalcapi"
| "_xxsubinterpreters" | "_xxsubinterpreters"
| "aifc"
| "asynchat" | "asynchat"
| "asyncore" | "asyncore"
| "audioop"
| "binhex" | "binhex"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "distutils" | "distutils"
| "dummy_threading" | "dummy_threading"
| "formatter" | "formatter"
| "imghdr"
| "imp" | "imp"
| "lib2to3"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "parser" | "parser"
| "pipes"
| "smtpd" | "smtpd"
| "sndhdr"
| "spwd"
| "sunau"
| "symbol" | "symbol"
| "telnetlib"
| "uu"
| "xdrlib"
) | ( ) | (
9, 9,
"_aix_support" "_aix_support"
| "_bootlocale" | "_bootlocale"
| "_bootsubprocess" | "_bootsubprocess"
| "_crypt"
| "_msi"
| "_peg_parser" | "_peg_parser"
| "_posixshmem" | "_posixshmem"
| "_sha256" | "_sha256"
@ -354,22 +378,44 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_testinternalcapi" | "_testinternalcapi"
| "_xxsubinterpreters" | "_xxsubinterpreters"
| "_zoneinfo" | "_zoneinfo"
| "aifc"
| "asynchat" | "asynchat"
| "asyncore" | "asyncore"
| "audioop"
| "binhex" | "binhex"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "distutils" | "distutils"
| "formatter" | "formatter"
| "graphlib" | "graphlib"
| "imghdr"
| "imp" | "imp"
| "lib2to3"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "parser" | "parser"
| "peg_parser" | "peg_parser"
| "pipes"
| "smtpd" | "smtpd"
| "sndhdr"
| "spwd"
| "sunau"
| "symbol" | "symbol"
| "telnetlib"
| "uu"
| "xdrlib"
| "zoneinfo" | "zoneinfo"
) | ( ) | (
10, 10,
"_aix_support" "_aix_support"
| "_bootsubprocess" | "_bootsubprocess"
| "_crypt"
| "_msi"
| "_posixshmem" | "_posixshmem"
| "_sha256" | "_sha256"
| "_sha512" | "_sha512"
@ -378,13 +424,33 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_testinternalcapi" | "_testinternalcapi"
| "_xxsubinterpreters" | "_xxsubinterpreters"
| "_zoneinfo" | "_zoneinfo"
| "aifc"
| "asynchat" | "asynchat"
| "asyncore" | "asyncore"
| "audioop"
| "binhex" | "binhex"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "distutils" | "distutils"
| "graphlib" | "graphlib"
| "imghdr"
| "imp" | "imp"
| "lib2to3"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "pipes"
| "smtpd" | "smtpd"
| "sndhdr"
| "spwd"
| "sunau"
| "telnetlib"
| "uu"
| "xdrlib"
| "xxlimited_35" | "xxlimited_35"
| "zoneinfo" | "zoneinfo"
) | ( ) | (
@ -394,6 +460,8 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "__phello_alias__" | "__phello_alias__"
| "_aix_support" | "_aix_support"
| "_bootsubprocess" | "_bootsubprocess"
| "_crypt"
| "_msi"
| "_posixshmem" | "_posixshmem"
| "_sha256" | "_sha256"
| "_sha512" | "_sha512"
@ -404,13 +472,33 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_typing" | "_typing"
| "_xxsubinterpreters" | "_xxsubinterpreters"
| "_zoneinfo" | "_zoneinfo"
| "aifc"
| "asynchat" | "asynchat"
| "asyncore" | "asyncore"
| "audioop"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "distutils" | "distutils"
| "graphlib" | "graphlib"
| "imghdr"
| "imp" | "imp"
| "lib2to3"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "pipes"
| "smtpd" | "smtpd"
| "sndhdr"
| "spwd"
| "sunau"
| "telnetlib"
| "tomllib" | "tomllib"
| "uu"
| "xdrlib"
| "xxlimited_35" | "xxlimited_35"
| "zoneinfo" | "zoneinfo"
) | ( ) | (
@ -419,6 +507,8 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "__hello_only__" | "__hello_only__"
| "__phello_alias__" | "__phello_alias__"
| "_aix_support" | "_aix_support"
| "_crypt"
| "_msi"
| "_posixshmem" | "_posixshmem"
| "_pydatetime" | "_pydatetime"
| "_pylong" | "_pylong"
@ -432,6 +522,54 @@ pub fn is_known_standard_library(minor_version: u8, module: &str) -> bool {
| "_xxinterpchannels" | "_xxinterpchannels"
| "_xxsubinterpreters" | "_xxsubinterpreters"
| "_zoneinfo" | "_zoneinfo"
| "aifc"
| "audioop"
| "cgi"
| "cgitb"
| "chunk"
| "crypt"
| "graphlib"
| "imghdr"
| "lib2to3"
| "mailcap"
| "msilib"
| "nis"
| "nntplib"
| "ossaudiodev"
| "pipes"
| "sndhdr"
| "spwd"
| "sunau"
| "telnetlib"
| "tomllib"
| "uu"
| "xdrlib"
| "xxlimited_35"
| "zoneinfo"
) | (
13,
"__hello_alias__"
| "__hello_only__"
| "__phello_alias__"
| "_aix_support"
| "_opcode_metadata"
| "_posixshmem"
| "_pydatetime"
| "_pylong"
| "_sha2"
| "_statistics"
| "_suggestions"
| "_sysconfig"
| "_testclinic"
| "_testclinic_limited"
| "_testinternalcapi"
| "_testsinglephase"
| "_tokenize"
| "_typing"
| "_xxinterpchannels"
| "_xxinterpqueues"
| "_xxsubinterpreters"
| "_zoneinfo"
| "graphlib" | "graphlib"
| "tomllib" | "tomllib"
| "xxlimited_35" | "xxlimited_35"

View File

@ -181,6 +181,7 @@ impl Configuration {
PythonVersion::Py310 => ruff_python_formatter::PythonVersion::Py310, PythonVersion::Py310 => ruff_python_formatter::PythonVersion::Py310,
PythonVersion::Py311 => ruff_python_formatter::PythonVersion::Py311, PythonVersion::Py311 => ruff_python_formatter::PythonVersion::Py311,
PythonVersion::Py312 => ruff_python_formatter::PythonVersion::Py312, PythonVersion::Py312 => ruff_python_formatter::PythonVersion::Py312,
PythonVersion::Py313 => ruff_python_formatter::PythonVersion::Py313,
}, },
line_width: self line_width: self
.line_length .line_length

View File

@ -605,7 +605,7 @@ Options:
RUFF_OUTPUT_FILE=] RUFF_OUTPUT_FILE=]
--target-version <TARGET_VERSION> --target-version <TARGET_VERSION>
The minimum Python version that should be supported [possible values: The minimum Python version that should be supported [possible values:
py37, py38, py39, py310, py311, py312] py37, py38, py39, py310, py311, py312, py313]
--preview --preview
Enable preview mode; checks will include unstable rules and fixes. Enable preview mode; checks will include unstable rules and fixes.
Use `--no-preview` to disable Use `--no-preview` to disable
@ -720,7 +720,7 @@ Options:
notebooks, use `--extension ipy:ipynb` notebooks, use `--extension ipy:ipynb`
--target-version <TARGET_VERSION> --target-version <TARGET_VERSION>
The minimum Python version that should be supported [possible values: The minimum Python version that should be supported [possible values:
py37, py38, py39, py310, py311, py312] py37, py38, py39, py310, py311, py312, py313]
--preview --preview
Enable preview mode; enables unstable formatting. Use `--no-preview` Enable preview mode; enables unstable formatting. Use `--no-preview`
to disable to disable

View File

@ -31,6 +31,7 @@ classifiers = [
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3 :: Only",
"Programming Language :: Rust", "Programming Language :: Rust",
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",

3
ruff.schema.json generated
View File

@ -2585,7 +2585,8 @@
"py39", "py39",
"py310", "py310",
"py311", "py311",
"py312" "py312",
"py313"
] ]
}, },
"Quote": { "Quote": {

View File

@ -12,6 +12,7 @@ VERSIONS: list[tuple[int, int]] = [
(3, 10), (3, 10),
(3, 11), (3, 11),
(3, 12), (3, 12),
(3, 13),
] ]
with PATH.open("w") as f: with PATH.open("w") as f: