Skip to content

bench(library): pilot 2, iniconfig from PyPI with its fence profile and two lowering slices (#417) - #1372

Merged
espetro merged 6 commits into
masterfrom
work/417-pilot2
Nov 24, 2026
Merged

espetro merged 6 commits into
masterfrom
work/417-pilot2

Conversation

@espetro

@espetro espetro commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Refs #417. Not Closes: the pilot does not yet compile end to end. Five blocker slices remain, each tracked (below), and the full CPython match is a strict xfail that flips when they land.

What this does

  • Target picked by measurement: iniconfig 2.3.1 has 22 root / 33 reachable fences, against tomli 2.5.0 at 43 / 81. Both are pure lane with no transitive dependencies.
  • Pilot program: benchmarks/library/iniconfig_pilot.py (PEP 723, dependencies = ["iniconfig"]), pinned by pylock.iniconfig_pilot.toml. It parses a literal pytest-style ini document through the documented API: ini["s"]["k"], a continuation value, lineof, in, and the ParseError text.
  • Runner: benchmarks/library/pilot2.py resolves through the deps lane, records the reachable fence profile from the plain compile and, once that profile is empty, diffs the binary against CPython.
  • Tests: tests/test_deps_receipt.py gains a network-gated pair:
    • a fence ceiling of 27 (master 69b54156 reads 33 and fails it);
    • the CPython match as a strict xfail.
  • No special-casing: the multi-root path needed nothing for this target. No vendoring, no path edits, and iniconfig._version is pruned.
  • Compiler slices:
    • a bare X: Final = value takes the value's type (module, function and plain-class scope; a dataclass body still fences);
    • a tuple display lowers each element against the expected tuple's field type, so return None, x under -> tuple[str | None, str | None] boxes into the optional.
  • Differential probe: probes/differential/bare_final_optional_tuple.py byte-matches CPython 3.14.

Fence profile, before / after

measurement before (69b54156) after
iniconfig coverage fences / root 23 / 22 17 / 16
iniconfig pilot, reachable 33 27
tomli coverage fences / root 51 / 43 49 / 41
tomli consumer, reachable 81 68
compat corpus (data/compat/compat.json) 3944 3904
compiler self-census 49 fewer over 16 modules (pyscriptc.lower +1)

Remaining blockers on the pilot path

The pilot leaves out IniConfig.get, whose _D | _T | str | None return is a separate PS1102 gap.

Verification

  • full suite (-n auto -m "not linux_container" --ignore=tests/compat2): 4032 passed. Its only 3 failures were stale generated data, regenerated in the last commit; those tests now pass (45 passed).
  • tests/compat2: 139 passed, 1 failed: test_macos_arm64_reference_is_a_separate_slot. It records a perf baseline on Darwin arm64 hosts only and does not touch lowering. CI (Linux) takes the refusal branch.
  • PYSC_NETWORK_TESTS=1 pytest tests/test_deps_receipt.py -k iniconfig: ceiling passes, match xfails on 27 == 0.
  • ruff check and format clean on touched files.

Docs

  • The Final row of the annotation table in docs/guide/python-subset.md is corrected. AGENTS.md names docs/guide/typing.md for that table, but the file does not exist.
  • The measurements and blocker table are in .agents/docs/benchmarks/library-receipt.md.

Owned files

src/pyscriptc/lower/__init__.py (_erase_bare_final, _desugar), src/pyscriptc/lower/_annotations.py (_tuple_expr), src/pyscriptc/lower/_expr.py (one call site), benchmarks/library/{iniconfig_pilot.py,pylock.iniconfig_pilot.toml,pilot2.py,README.md}, tests/test_pilot2_slices.py, tests/test_deps_receipt.py, probes/differential/bare_final_optional_tuple.py, .agents/docs/benchmarks/library-receipt.md, .agents/docs/python-style.md, docs/guide/python-subset.md. Regenerated, never hand-merged: tests/census_pins/* (17 shards), data/compat/support.json, data/compat/compat.json.

🤖 Generated with Claude Code

@espetro espetro added this to the v0.11.0 milestone Nov 24, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Deploying pyscriptc with  Cloudflare Pages  Cloudflare Pages

Latest commit: a22559a
Status: ✅  Deploy successful!
Preview URL: https://5027c99e.pyscriptc.pages.dev
Branch Preview URL: https://work-417-pilot2.pyscriptc.pages.dev

View logs

…le returns (#417)

Two refusals on the measured iniconfig 2.3.1 profile (pilot 2):

- X: Final = value (bare PEP 591 qualifier) lowers as X = value in module
  and function scopes; the typing/typing_extensions spellings only.
- A tuple display lowers each element against the expected tuple's field
  type, so return None, x under -> tuple[str | None, str | None] boxes the
  None arm into the field optional.

The self-census repin follows: the tuple change lowers 49 more fences of
the compiler's own source (16 modules down, pyscriptc.lower up 1 for the
new helper).
A class with no decorator, base or keyword reads FROZEN: Final = 0 as a
class constant, so the qualifier erasure covers it (tomli's Flags). A
dataclass or NamedTuple body keeps its annotation: there a bare Final is
a field.
… a CPython diff (#417)

iniconfig_pilot.py is a PEP 723 program naming iniconfig only, pinned by
pylock.iniconfig_pilot.toml (2.3.1). pilot2.py resolves it through the
deps lane, records the reachable fence profile from the plain compile and,
once the profile is empty, diffs the binary against CPython.

tests/test_deps_receipt.py gains the network-gated pair: the profile stays
under the measured ceiling (27; master 69b5415 reads 33), and the full
CPython match is a strict xfail that turns into a failure when the profile
reaches zero.
…lices (#417)

Records the measured iniconfig/tomli profiles before and after the #417
slices, the five blocker slices left on the pilot's reachable path (#1368,
#448, #1369, #1370, #446) and the corrected Final row of the annotation
table. The pilot drops IniConfig.get: its multi-arm optional return is a
gap of its own the library path does not need.
…slices

Corpus fences 3944 to 3904; iniconfig loses its type-mismatch row.
@espetro
espetro merged commit 05947d6 into master Nov 24, 2026
59 of 64 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in pyscriptc Nov 24, 2026
@espetro
espetro deleted the work/417-pilot2 branch November 24, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant