From 6c2529800a593fdf7f8cd123b1b17e33be0f03aa Mon Sep 17 00:00:00 2001 From: youknowdot Date: Fri, 9 Oct 2026 23:55:56 +0900 Subject: [PATCH] Target Python 3.15 using the final upstream reference Update active version and comparison configuration to Python 3.15.0. Preserve the alpha implementation status, actual bytecode format, and existing libraries pending separate migration. Align generated library-upgrade workflow pins without changing permissions or actions. Assisted-by: OpenAI Codex:model identifier unavailable --- .claude/scripts/setup-env.sh | 6 +++--- .github/workflows/pyperformance.yaml | 2 +- .github/workflows/update-doc-db.yml | 2 +- .github/workflows/upgrade-pylib.lock.yml | 6 +++--- .github/workflows/upgrade-pylib.md | 4 ++-- .python-version | 2 +- AGENTS.md | 2 +- CONTRIBUTING.md | 2 +- README.md | 4 +++- crates/vm/build.rs | 4 ++-- crates/vm/src/stdlib/_ast.rs | 6 +++--- crates/vm/src/vm/mod.rs | 2 +- extra_tests/snippets/stdlib_sys.py | 6 ++++++ scripts/libc_posix.py | 2 +- scripts/whats_left.py | 6 +++--- 15 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.claude/scripts/setup-env.sh b/.claude/scripts/setup-env.sh index f5d28a3f1..f6a1e8366 100755 --- a/.claude/scripts/setup-env.sh +++ b/.claude/scripts/setup-env.sh @@ -16,7 +16,7 @@ if [ "$(printf '%s\n' "3.13" "$CURRENT_PY" | sort -V | head -1)" != "3.13" ]; th echo "Upgrading python3 default to 3.13..." # Find best available Python >= 3.13 TARGET="" - for ver in python3.14 python3.13; do + for ver in python3.15 python3.14 python3.13; do if command -v "$ver" &>/dev/null; then TARGET=$(command -v "$ver") break @@ -40,8 +40,8 @@ fi # 2. Clone CPython source if not present (needed for scripts/update_lib) if [ ! -d "cpython" ]; then - echo "Cloning CPython v3.14.3 (shallow)..." - git clone --depth 1 --branch v3.14.3 https://github.com/python/cpython.git cpython + echo "Cloning CPython v3.15.0 (shallow)..." + git clone --depth 1 --branch v3.15.0 https://github.com/python/cpython.git cpython echo "CPython source ready." else echo "CPython source already present." diff --git a/.github/workflows/pyperformance.yaml b/.github/workflows/pyperformance.yaml index 1d304582c..d6ef2764b 100644 --- a/.github/workflows/pyperformance.yaml +++ b/.github/workflows/pyperformance.yaml @@ -63,7 +63,7 @@ jobs: - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 id: cpython with: - python-version: "3.14" + python-version: "3.15" - name: Restore cache uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 diff --git a/.github/workflows/update-doc-db.yml b/.github/workflows/update-doc-db.yml index 8874c3aea..3abdf27de 100644 --- a/.github/workflows/update-doc-db.yml +++ b/.github/workflows/update-doc-db.yml @@ -8,7 +8,7 @@ on: python-version: description: Target python version to generate doc db for type: string - default: "3.14.7" + default: "3.15.0" base-ref: description: Base branch to create the update branch from type: string diff --git a/.github/workflows/upgrade-pylib.lock.yml b/.github/workflows/upgrade-pylib.lock.yml index c08d19058..0199a8850 100644 --- a/.github/workflows/upgrade-pylib.lock.yml +++ b/.github/workflows/upgrade-pylib.lock.yml @@ -24,7 +24,7 @@ # Pick an out-of-sync Python library from the todo list and upgrade it # by running `scripts/update_lib quick`, then open a pull request. # -# frontmatter-hash: 3129480d6628afe028911bb8b31b6bb3b5eb251e395f00ed0677922cd21727cb +# frontmatter-hash: 4c8478ae37e731fb9e34ca116a5fcbdd4f23b00f6f4d148df40f4db52b3bea6e name: "Upgrade Python Library" "on": @@ -44,7 +44,7 @@ run-name: "Upgrade Python Library" env: ISSUE_ID: "6839" - PYTHON_VERSION: v3.14.3 + PYTHON_VERSION: v3.15.0 # Cache configuration from frontmatter was processed and added to the main job steps @@ -109,7 +109,7 @@ jobs: - name: Setup Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: - python-version: '3.14' + python-version: '3.15' - name: Create gh-aw temp directory run: bash /opt/gh-aw/actions/create_gh_aw_tmp_dir.sh # Cache configuration from frontmatter processed below diff --git a/.github/workflows/upgrade-pylib.md b/.github/workflows/upgrade-pylib.md index cd05eb777..fbb7087a4 100644 --- a/.github/workflows/upgrade-pylib.md +++ b/.github/workflows/upgrade-pylib.md @@ -28,7 +28,7 @@ engine: copilot runtimes: python: - version: "3.14" + version: "3.15" tools: bash: @@ -52,7 +52,7 @@ cache: - cpython-lib- env: - PYTHON_VERSION: "v3.14.7" + PYTHON_VERSION: "v3.15.0" ISSUE_ID: "6839" --- diff --git a/.python-version b/.python-version index a128d5c0d..f02113fe8 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.14.7 +3.15.0 diff --git a/AGENTS.md b/AGENTS.md index ae24d4167..9aa4cc677 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ This document provides guidelines for AI coding agents (GitHub Copilot, Claude C ## Project Overview -RustPython is a Python 3 interpreter written in Rust, implementing Python 3.14.0+ compatibility. The project aims to provide: +RustPython is a Python 3 interpreter written in Rust, targeting Python 3.15 with compatibility work in progress. The project aims to provide: - A complete Python-3 environment entirely in Rust (not CPython bindings) - A clean implementation without compatibility hacks diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 637ecf099..710bb2caf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,7 +49,7 @@ RustPython requires the following: stable version: `rustup update stable` - If you do not have Rust installed, use [rustup](https://rustup.rs/) to do so. -- CPython version 3.14 or higher +- CPython version 3.15 or higher - CPython can be installed by your operating system's package manager, from the [Python website](https://www.python.org/downloads/), or using a third-party distribution, such as diff --git a/README.md b/README.md index 1fc891b79..c28e2fbed 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ # [RustPython](https://rustpython.github.io/) -A Python-3 (CPython >= 3.14.0) Interpreter written in Rust :snake: :scream: +A Python-3 interpreter written in Rust, targeting CPython 3.15 :snake: :scream: :metal:. +Python 3.15 compatibility is a work in progress. + [![Build Status](https://github.com/RustPython/RustPython/workflows/CI/badge.svg)](https://github.com/RustPython/RustPython/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/RustPython/RustPython/branch/main/graph/badge.svg)](https://codecov.io/gh/RustPython/RustPython) [![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/RustPython/RustPython?utm_source=badge) diff --git a/crates/vm/build.rs b/crates/vm/build.rs index 867cf5775..098cf05aa 100644 --- a/crates/vm/build.rs +++ b/crates/vm/build.rs @@ -22,8 +22,8 @@ fn main() { } println!("cargo:rerun-if-changed=../../Lib/importlib/_bootstrap.py"); - // = 3.14.0alpha - python_version(3, 14, 0, "alpha", 0); + // = 3.15.0alpha + python_version(3, 15, 0, "alpha", 0); println!("cargo:rustc-env=RUSTPYTHON_GIT_HASH={}", git_hash()); println!( diff --git a/crates/vm/src/stdlib/_ast.rs b/crates/vm/src/stdlib/_ast.rs index 497dec48b..6560d7ee1 100644 --- a/crates/vm/src/stdlib/_ast.rs +++ b/crates/vm/src/stdlib/_ast.rs @@ -1804,7 +1804,7 @@ pub(crate) fn parse>( ) -> Result { let source_file = SourceFileBuilder::new(filename.to_owned(), source.to_owned()).finish(); let mut options = parser::ParseOptions::from(mode); - let target_version = target_version.unwrap_or(ast::PythonVersion::PY314); + let target_version = target_version.unwrap_or(ast::PythonVersion::PY315); if let Some(error) = feature_version_syntax_error(source, &source_file, target_version) { return Err(error.into()); } @@ -2045,7 +2045,7 @@ pub(crate) fn parse_func_type>( let parse_expr = |expr_src: &str| -> Result { let source_file = SourceFileBuilder::new(filename.to_owned(), expr_src.to_owned()).finish(); let options = parser::ParseOptions::from(parser::Mode::Expression) - .with_target_version(target_version.unwrap_or(ast::PythonVersion::PY314)); + .with_target_version(target_version.unwrap_or(ast::PythonVersion::PY315)); let parsed = parser::parse(expr_src, options).map_err(|parse_error| { let range = text_range_to_source_range(&source_file, parse_error.location); CompileError::from(ParseError { @@ -2080,7 +2080,7 @@ pub(crate) fn parse_func_type>( let call_source = format!("{ARG_PREFIX}{inner})"); let source_file = SourceFileBuilder::new(filename.to_owned(), call_source.clone()).finish(); let options = parser::ParseOptions::from(parser::Mode::Expression) - .with_target_version(target_version.unwrap_or(ast::PythonVersion::PY314)); + .with_target_version(target_version.unwrap_or(ast::PythonVersion::PY315)); let parsed = parser::parse(&call_source, options).map_err(|parse_error| { let range = text_range_to_source_range(&source_file, parse_error.location); CompileError::from(ParseError { diff --git a/crates/vm/src/vm/mod.rs b/crates/vm/src/vm/mod.rs index 238b19a2b..ac1b96a46 100644 --- a/crates/vm/src/vm/mod.rs +++ b/crates/vm/src/vm/mod.rs @@ -1607,7 +1607,7 @@ impl VirtualMachine { /// ```no_run /// use rustpython_vm::Interpreter; /// Interpreter::without_stdlib(Default::default()).enter(|vm| { - /// let bytes = std::fs::read("__pycache__/.rustpython-314.pyc").unwrap(); + /// let bytes = std::fs::read("__pycache__/.rustpython-315.pyc").unwrap(); /// let main_scope = vm.new_scope_with_main().unwrap(); /// vm.run_pyc_bytes(&bytes, main_scope); /// }); diff --git a/extra_tests/snippets/stdlib_sys.py b/extra_tests/snippets/stdlib_sys.py index 9dba301fb..7d8dc0e33 100644 --- a/extra_tests/snippets/stdlib_sys.py +++ b/extra_tests/snippets/stdlib_sys.py @@ -25,6 +25,12 @@ assert "sys" in sys.builtin_module_names assert isinstance(sys.implementation.name, str) assert isinstance(sys.implementation.cache_tag, str) +if sys.implementation.name == "rustpython": + assert sys.version_info == (3, 15, 0, "alpha", 0) + assert sys.hexversion == 0x030F00A0 + assert sys.version.startswith("3.15.0.alpha (") + assert sys.implementation.cache_tag == "rustpython-315" + assert sys.getfilesystemencoding() == "utf-8" assert sys.getfilesystemencodeerrors().startswith("surrogate") diff --git a/scripts/libc_posix.py b/scripts/libc_posix.py index 82f3eb96d..139235244 100644 --- a/scripts/libc_posix.py +++ b/scripts/libc_posix.py @@ -8,7 +8,7 @@ import urllib.request import tomllib -CPYTHON_VERSION = "3.14" +CPYTHON_VERSION = "3.15" CONSTS_PATTERN = re.compile(r"\b_*[A-Z]+(?:_+[A-Z]+)*_*\b") diff --git a/scripts/whats_left.py b/scripts/whats_left.py index 40b7b5be9..9adae4c9c 100755 --- a/scripts/whats_left.py +++ b/scripts/whats_left.py @@ -1,6 +1,6 @@ #!/usr/bin/env -S python3 -I # /// script -# requires-python = ">=3.14" +# requires-python = ">=3.15.0" # /// # This script generates Lib/snippets/whats_left_data.py with these variables defined: @@ -39,9 +39,9 @@ GENERATED_FILE = "extra_tests/not_impl.py" implementation = platform.python_implementation() if implementation != "CPython": sys.exit(f"whats_left.py must be run under CPython, got {implementation} instead") -if sys.version_info[:2] < (3, 14): +if sys.version_info[:2] < (3, 15): sys.exit( - f"whats_left.py must be run under CPython 3.14 or newer, got {implementation} {sys.version} instead. If you have uv, try `uv run python -I scripts/whats_left.py` to select a proper Python interpreter easier." + f"whats_left.py must be run under CPython 3.15 or newer, got {implementation} {sys.version} instead. If you have uv, try `uv run python -I scripts/whats_left.py` to select a proper Python interpreter easier." )