Skip to content

Feat: Regenerate the stubs from the binder's #53 output, typing object members properly - #49

Merged
b-re-w merged 1 commit into
developfrom
work/stubs-53
Oct 3, 2026
Merged

b-re-w merged 1 commit into
developfrom
work/stubs-53

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 3, 2026

Copy link
Copy Markdown
Member

Refs #12

Regenerates the stubs from python-multiplatform run 37098191598 (fa2558e3). Fixes the two converter problems the newer input exposed:

  • Property setters: a property and its .setter decorator are now renamed together.
  • Nested types: nested types like Alignment.Horizontal move into the folded object as nested classes. Each one is both the Kotlin type and the notebook's group, so Alignment.End and Alignment.Horizontal.End type as Alignment.Horizontal, and Alignment.Horizontal.Top still fails mypy.

Object functions such as Arrangement.spaced_by are snake_case staticmethods. colors: bool is gone.
Still Any: Arrangement.HorizontalOrVertical and anything typed with it, because upstream lists one base where Kotlin has two (reported); object self-types such as Alignment.Center; Icons.Default.Add (python-multiplatform #68).

Test added: 7 generator tests on a new-format fixture, plus 2 mypy cases. Red: 6 of 7 failed. Disable checks fail 1 / 5.

Environment (worktree, new zip) Before After
python-multiplatform 31c092f0 193 passed, 1 skipped 202 passed, 1 skipped
no checkout 107 passed, 87 skipped 116 passed, 87 skipped

Drafted by a subagent; reviewed and re-run here.

…t members properly

python-multiplatform's newer kotlin-stubs (run 37098191598, fa2558e3: its
#53, #44/#49 and #38 property stubs) stubs object functions, gives object
constants their nested types, types *ItemColors parameters, and emits
properties with setters. Converting it as-is broke mypy two ways, both in
gen_stubs.py:

- A property was renamed to snake_case but its `@layoutDirection.setter`
  decorator was not. The property and its decorators are now renamed
  together, at module level and in classes.
- An object's nested types (Alignment.Horizontal) live in the object's own
  stub upstream; folded into the parent stub as a class, bare `Horizontal`
  no longer resolved and collided with this package's grouping namespace.
  The nested types now move in as nested classes, and each one IS the group
  as well: Alignment.End and Alignment.Horizontal.End both type as
  Alignment.Horizontal, Alignment.Horizontal.Top still fails, and references
  from other modules become pythonx.compose.ui.Alignment.Horizontal.

Object functions are snake_case staticmethods (Arrangement.spaced_by), an
explicit overload set also gets its base name. Upstream gives
Arrangement.HorizontalOrVertical one base where Kotlin has two, which made
mypy reject the notebook's Column(vertical_arrangement=Arrangement.SpaceBetween);
annotations naming such a type are Any until upstream lists both bases.

colors: bool goes from 9 to 0 in material3.

Drafted by a subagent in a worktree; reviewed and re-run here.

feature added: property, nested-type and object-function conversion.
test added: TheObjectAndPropertyFormat (7) over a new-format fixture, two mypy
cases (object function and nested types; property and setter). Red: 6 of 7
failed. Disabling the decorator rename fails 1; the nested-name qualification 5.
documentation corrected: SPEC 0/S1.2/S7.1 (stale per-step counts replaced),
PROJECT.md, guide status and getting-started.
Suite with python-multiplatform 31c092f0 (worktree, new zip): 193 passed, 1
skipped -> 202 passed, 1 skipped; without a checkout, 107 passed, 87 skipped
-> 116 passed, 87 skipped. Generating twice gives no diff. check_guide.py: 0.

Refs #12
@b-re-w
b-re-w merged commit 7ae24ac into develop Oct 3, 2026
6 checks passed
@b-re-w
b-re-w deleted the work/stubs-53 branch October 3, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant