Files
RustPython/.github/workflows/pyperformance.yaml
T
youknowdotandJeong, YunWon 06007c81fa Begin the Python 3.15 target and essential-library migration (#8950)
* 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

* Adapt essential snippet contracts to Python 3.15 final

Preserve existing coverage while following verified final behavior for script metadata, builtin signatures and loading, AST fixture construction, memoryview diagnostics, mmap search bounds, and struct format errors. The unchanged final comparator exposes the earlier expectations; focused native baseline failures establish the required implementation changes.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep final-reference regression paths and remove expired sysconfig argument

Preserve reverse multiplication syntax and native exact overflow diagnostics. Accept the two source-proven CPython 3.15 specialization messages only in affected reverse str/bytes/tuple cases. Use an actually out-of-range Windows datetime errno fixture. Remove the sysconfig check_home argument at its existing canonical 3.15 removal test boundary.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep README wording unchanged in Python 3.15 transition

Assisted-by: OpenAI Codex:model identifier unavailable

* Match Python 3.15 repetition specialization and keep universal tests

Use exact sequence-type guards and preserve generic fallback diagnostics. Validate both cold and warmed expressions without implementation-specific assertions. Reject stale CPython source checkouts and cross-version library caches.

Assisted-by: OpenAI Codex:model identifier unavailable

* Limit in-place specialization additions to exact sequence repetition

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep subclass regression scoped to repetition dispatch

Assisted-by: OpenAI Codex:model identifier unavailable

* Provision final CPython 3.15 with pinned uv builds

Assisted-by: OpenAI Codex:model identifier unavailable

* Enforce Python 3.15 AST constructor requirements

Reject retired missing-field and arbitrary-keyword forms while preserving defaults and explicit placeholders. Sync only matching final CPython constructor test hunks.

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep seeded Python ahead of its Windows DLL directory

Assisted-by: OpenAI Codex:model identifier unavailable

* Keep opcode metadata tied to the implemented bytecode format

The interpreter target and reference tests use Python 3.15.0, but the current Rust opcode enum retains the 3.14 bytecode format. Generate metadata from its matching source rather than importing unsupported instruction families.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align CSV, logarithm and decimal formatting with Python 3.15

Propagate dialect lookup errors except AttributeError, retry integer logarithms after float overflow, and update the decimal conversion diagnostic. Exercise the final reference contracts without implementation-specific branches.

Assisted-by: OpenAI Codex:model identifier unavailable

* Bind the logarithm index result before borrowing its integer

Assisted-by: OpenAI Codex:model identifier unavailable

* Align required canonical test expectations with Python 3.15

Take only demonstrated contract changes from CPython v3.15.0, d220409a13b77de7a6c30abe16ea90db01528edc: removed module __cached__, Struct format exception classes, and decimal-format diagnostic. Preserve unrelated tests and expectations.

Assisted-by: OpenAI Codex:model identifier unavailable

* Track pending frozendict pickle support during the 3.15 transition

Keep the two existing frozendict pickle tests running as expected failures until #8951 supplies the builtin. Unexpected success will signal removal of these temporary markers.

Assisted-by: OpenAI Codex:model identifier unavailable

* Support final Python 3.15 Windows negative timestamps

Use FILETIME for pre-epoch conversions and preserve precise Windows timestamp errors.

Assisted-by: OpenAI Codex:model identifier unavailable

* Derive historical Windows timezone offsets from wall time

FILETIME reports historical DST as unknown, so calculate the actual offset rather than selecting standard-time bias.

Assisted-by: OpenAI Codex:model identifier unavailable

* Identify decimal formatting arguments in Python 3.15 errors

Track consumed positional arguments, including star width and precision, and preserve mapping key representations in decimal conversion diagnostics.

Assisted-by: OpenAI Codex:model identifier unavailable

* Reuse mapping format keys for lookup and error context

Assisted-by: OpenAI Codex:model identifier unavailable

* Borrow mapping diagnostic keys as Python objects

Assisted-by: OpenAI Codex:model identifier unavailable

* Avoid empty components in the reference Python library path

Assisted-by: OpenAI Codex:model identifier unavailable

* Isolate RustPython bytecode caches during the 3.15 transition

Assisted-by: OpenAI Codex:model identifier unavailable

* Sync final Windows timestamp test expectations

Import only the final CPython platform-limit guards and mktime roundtrip expectation required by the existing Windows CI suite.

Assisted-by: OpenAI Codex:model identifier unavailable

* Restore official Python setup for 3.15 final

Use the existing pinned setup-python action now that its official catalog supplies CPython 3.15.0. Remove the temporary standalone provisioning action and its sparse-checkout entry while retaining interpreter outputs and requested versions.

Assisted-by: OpenAI Codex:model identifier unavailable

* Align merged runtime contracts with Python 3.15 final

Restrict mappingproxy ordering, use final codec registry normalization, and prefer index conversion before float conversion for sleep. Retain universal Python assertions and import the matching final codec/time canonical test hunks plus the non-ASCII codec-name deprecation warning.

Upstream source: CPython d220409a13b77de7a6c30abe16ea90db01528edc. The existing codec normalization implementation and bytecode contract remain unchanged.

Assisted-by: OpenAI Codex:model identifier unavailable

* Limit Windows launcher version check to its interpreter

Exclude only the CPython py.exe version-identity case from RustPython CI. The installed launcher reports its own final version, while RustPython correctly remains alpha. Preserve the other 45 launcher cases and all RustPython version assertions without modifying Lib.

Assisted-by: OpenAI Codex:model identifier unavailable

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-10-11 12:57:49 +09:00

221 lines
8.8 KiB
YAML

on:
pull_request:
types: [labeled, opened, synchronize, reopened]
workflow_dispatch:
name: pyperformance
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CI: true
# Pure-Python benchmarks only: anything whose workload needs a real C
# extension cannot install under RustPython at all, and the async/SSL ones
# are far too slow here to be worth a runner's time. Keep this list short --
# every entry is paid for three times (CPython, base, head) in one job.
BENCHMARKS: >-
chaos,comprehensions,coroutines,deepcopy,deltablue,fannkuch,float,
generators,go,hexiom,json_dumps,json_loads,logging,mdp,nbody,nqueens,
pickle_pure_python,raytrace,regex_compile,regex_v8,richards,scimark,
spectral_norm,telco,typing_runtime_protocols,unpack_sequence,
unpickle_pure_python,xml_etree
# A benchmark that needs longer than this on the base commit is one this
# comparison cannot afford to wait for; it shows up as a failure in the
# table, which is itself the interesting signal.
BENCH_TIMEOUT: 300
jobs:
compare:
# `skip:ci` mirrors the other workflows; `run:pyperformance` opts a PR in,
# because the job costs well over an hour and most PRs do not need it.
if: >-
github.event_name == 'workflow_dispatch' ||
(!contains(github.event.pull_request.labels.*.name, 'skip:ci') &&
contains(github.event.pull_request.labels.*.name, 'run:pyperformance'))
name: base vs. head vs. CPython
runs-on: ubuntu-latest
timeout-minutes: 300
permissions:
contents: read
# Honoured for a pull request opened from this repo, which is then
# commented on directly by the last step; a fork's run is handed
# read-only whatever is asked for here and goes the artifact route.
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
# Both the third interpreter under test and the host pyperformance
# itself runs on (it only runs under a real CPython; RustPython is just
# the `--python` target it drives).
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
id: cpython
with:
python-version: "3.15.0"
- name: Restore cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: pyperformance-${{ hashFiles('**/Cargo.lock') }}
restore-keys: pyperformance-
continue-on-error: true
# The base commit may predate these scripts, and `git checkout <base>`
# below would then delete them; run them from a copy outside the tree.
- name: Copy the benchmark scripts out of the checkout
run: cp -r scripts/pyperformance "${RUNNER_TEMP}/pyperformance-scripts"
# Each build is copied aside with the stdlib of its own commit, so the
# second does not overwrite the first and a PR that touches `Lib/` is
# still compared against the base commit's `Lib/`. A binary moved away
# from its checkout finds the stdlib only through RUSTPYTHONPATH, which
# `run_all.py` forwards through pyperf into the venv it builds.
- name: Build head
run: |
cargo build --release --locked
mkdir -p "${RUNNER_TEMP}/head"
cp target/release/rustpython "${RUNNER_TEMP}/head/rustpython"
cp -r Lib "${RUNNER_TEMP}/head/Lib"
- name: Build base
continue-on-error: true # a base that cannot build leaves head vs. CPython
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
git checkout --quiet "${BASE_SHA}" --
cargo build --release --locked
mkdir -p "${RUNNER_TEMP}/base"
cp target/release/rustpython "${RUNNER_TEMP}/base/rustpython"
cp -r Lib "${RUNNER_TEMP}/base/Lib"
- name: Restore head checkout
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: git checkout --quiet "${HEAD_SHA}" --
- name: Save cache
if: always()
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: pyperformance-${{ hashFiles('**/Cargo.lock') }}
continue-on-error: true
# The three runs are deliberately adjacent, with no build between them,
# so nothing but the interpreter differs across the comparison.
- name: Measure CPython
env:
CPYTHON: ${{ steps.cpython.outputs.python-path }}
run: |
python3 "${RUNNER_TEMP}/pyperformance-scripts/run_all.py" \
--python "${CPYTHON}" \
--label cpython --no-psutil-stub \
--benchmarks "${BENCHMARKS//[$'\n' ]/}" \
--timeout "${BENCH_TIMEOUT}" --out "${RUNNER_TEMP}/pyperf-results"
- name: Measure base
continue-on-error: true # as above: the table falls back to head alone
env:
RUSTPYTHONPATH: ${{ runner.temp }}/base/Lib
run: |
python3 "${RUNNER_TEMP}/pyperformance-scripts/run_all.py" \
--python "${RUNNER_TEMP}/base/rustpython" \
--label base \
--benchmarks "${BENCHMARKS//[$'\n' ]/}" \
--timeout "${BENCH_TIMEOUT}" --out "${RUNNER_TEMP}/pyperf-results"
- name: Measure head
env:
RUSTPYTHONPATH: ${{ runner.temp }}/head/Lib
run: |
python3 "${RUNNER_TEMP}/pyperformance-scripts/run_all.py" \
--python "${RUNNER_TEMP}/head/rustpython" \
--label head \
--benchmarks "${BENCHMARKS//[$'\n' ]/}" \
--timeout "${BENCH_TIMEOUT}" --out "${RUNNER_TEMP}/pyperf-results"
- name: Render the comparison
env:
CPYTHON_VERSION: ${{ steps.cpython.outputs.python-version }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
python3 "${RUNNER_TEMP}/pyperformance-scripts/pr_diff.py" \
--results-dir "${RUNNER_TEMP}/pyperf-results" \
--cpython-version "CPython ${CPYTHON_VERSION}" \
--md diff.md --json diff.json
echo "${PR_NUMBER}" > pr_number.txt
# A `pull_request` run triggered from a fork carries a read-only token no
# matter what this workflow grants, so the comment is posted from
# `pyperformance-comment.yaml`, which `workflow_run` runs in the base
# repo's context. This artifact is the hand-off.
- name: Upload the comparison
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pyperformance-diff
path: |
diff.md
diff.json
pr_number.txt
retention-days: 14
if-no-files-found: ignore
# A pull request opened from this repo can be commented on from here,
# which puts the table on the PR in the same run instead of waiting for
# the companion workflow. Forks fall through to that workflow instead.
- name: Post or update the PR comment
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('diff.md', 'utf8');
const marker = '<!-- pyperformance-local-diff -->';
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
const existing = comments.find((c) => c.body && c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body,
});
}