Skip to content

t27o: Python dynamics -- a static subset with trace-based type inference (RightTyper, MonkeyType, Codon) #9006

Open

Description

@gHashTag

Part of the effects-at-the-edge epic; it feeds #8995. Research basis:

  • RightTyper (arXiv 2507.16051) and MonkeyType: types observed at run time, with sampling, combined with static analysis.
  • Codon: compiles Python ahead of time with bidirectional static type inference, and refuses runtime type changes.

Design:

  • t27o runs the original Python under the oracle and records types at function boundaries.
  • Widths are chosen from the observed integer ranges.
  • A value seen with several types becomes a tagged union.
  • Dynamic features (eval, monkeypatching, runtime type change, metaclasses) are refused by name.

Acceptance: types inferred for one scripts/*.py module, and a verified t27 port of at least one function.

Activity

  1. gHashTag commented on Oct 19, 2026

    @gHashTag
    OwnerAuthor

    Measured 2026-10-20 (census #11168, document docs/now/2026-10-20-python-debt.md in PR #11176): of 331,183 distinct hand-written, non-test Python lines in the five repositories, 812 (0.25%) sit in the 105 functions that fit a typed subset today and 4,090 (1.23%) in the 454 that fit once parameter types are inferred from traces (this issue's design). No file is a whole-file candidate of 150 lines or more, and the median in-subset function has 6 lines, so a Python port deletes functions, not files, and t27c gen-python lowers no function today. Pure code blocked only by heap values (owned strings, dict/set, comprehensions, union/None returns, pure stdlib imports) is a further 1,293 fns / 16,577 lines (5.0%): the same wall as the Rust census.

    Verdict from the loop, on the threshold set before the measurement (a whole-file candidate of at least 150 lines): not met, so no Python front end is being built now. This issue stays open as the roadmap item; what would change the answer is t27 gaining the heap values named above, which is the decision recorded in the t27o report (default: not started).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions