Skip to content

TypedPython 1b: run the gate as a default Gradle build step #20

Closed

Description

@b-re-w

What

A Gradle task in python-multiplatform-gradle-plugin runs python -m typedpython check over the project's own Python sources on every build, with those sources as task inputs so incremental builds re-run it. The build fails on errors. Warnings are printed. Dependencies are not checked. The gate package ships inside the python-multiplatform-ksp artefact.

Why

INTENT §1.4: checking is PythonMultiplatform's default behaviour.

Coordination

This overlaps the PMM build supporter's area and is agreed with that session before work starts.

Done when

  • A fixture build fails on an injected Any leak and passes when it is removed.
  • Changing only a .py file re-runs the task.
  • The gate's error count on sample/ and pythonx-compose consumer code is recorded as a baseline.

Activity

  1. b-re-w commented on Oct 3, 2026

    @b-re-w
    MemberAuthor

    Paired with #183 (import-time gate in development mode), decided 2026-10-04: the build gate (this issue) covers builds; #183 covers notebook cells, hot reload and debug runs.

  2. b-re-w commented on Oct 17, 2026

    @b-re-w
    MemberAuthor

    Status (2026-10-17).

    Implemented in toolchain (toolchain #34, toolchain SPEC 1.18):

    • What is in place:
      • typedpythonCheck runs before every buildPython*.
      • .py/.pyi files are inputs, so changing only a .py re-runs the check, and other files leave it UP-TO-DATE; toolchain's own tests cover both.
      • A failed check fails the build.
    • Criterion 1 (a fixture build fails on an injected Any leak) is not covered by a toolchain test I could find.

    Gap, the reason this issue stays open: the check is skipped with a warning unless -Ptypedpython.wheelDir=<dir> is passed. The typedpython wheel is not on PyPI, and toolchain refuses index installs on purpose (the name is unclaimed). So checking is not yet on by default for a consumer.

    Baseline (criterion 3), gate from develop de8f94f, --mode checked, CPython 3.15.0rc1t, no Kotlin stubs on the search path, so androidx imports are untyped and inflate any-flow:

    source result
    sample/src/commonMain/python/example_py (1 file) clean (exit 0)
    pythonx-compose/pythonx (pythonx-compose 7490751) 253 errors, 7 warnings

    pythonx-compose by rule:

    rule count
    any-flow 178
    pyrefly/unannotated-return 36
    pyrefly/implicit-any-parameter 32
    forbidden/dynamic-attr 6
    pyrefly/unknown-variable-type 3
    pyrefly/unknown-name 1
    pyrefly/no-any-return-implicit 1
    pyrefly/missing-import 1
    pyrefly/bad-return 1
    forbidden/rebinding 1

    The gap needs a decision; options are in the next comment from the coordinating session.

  3. added a commit that references this issue on Oct 17, 2026
  4. b-re-w commented on Oct 17, 2026

    @b-re-w
    MemberAuthor

    Done. The gate runs by default for consumers:

    Criteria:

    1. an Any leak fails buildPython with the gate's diagnostic, and fixing it passes (toolchain TypedpythonCheckTaskTest).
    2. A changed .py re-runs the check, and other files leave it UP-TO-DATE (same test class).
    3. The baseline is recorded above: sample is clean; pythonx-compose has 253 errors and 7 warnings without Kotlin stubs, handed to the pythonx-compose designer for a re-run with stubs.

    A gate artifact missing from the repositories is a skip with a warning (TypedpythonGateArtifactTest), and a pyrefly matching none of the hashes fails the task.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions