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

View File

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

View File

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

View File

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

View File

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

View File

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

3
ruff.schema.json generated
View File

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

View File

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