Repository navigation
feat: redesign Python API with direct handles, Vec2 math, attribute input, and proxy caching - #19
Merged
Merged
Conversation
mkh-user
force-pushed
the
feat/api-redesign
branch
from
November 2, 2026 13:23
35f060d to
a63bcb9
Compare
…nput, and proxy caching
mkh-user
force-pushed
the
feat/api-redesign
branch
from
November 2, 2026 13:32
a63bcb9 to
a6910cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR redesigns Pite's Python scripting API and engine runtime integration based on our architectural proposal and expert review:
Vec2PyClass & Direct Struct-Backed Transform Handles:Vec2supports vector arithmetic (+,-,*,/), in-place mutation (+=,-=,*=,/=), indexing[0],[1], unpackingx, y = self.position, tuple assignmentself.position = (x, y), and.length()/.normalized().ScriptHost(self.position.x += 10.0writes straight to engine tree state).getattr/ mutex lock / string allocation sync pass inGameSession::update.Attribute-Based Input API with Deprecation Cut:
pite.held.<key>,pite.pressed.<key>, andpite.released.<key>(e.g.pite.held.right,pite.pressed.space).TypeErrorwhen invoking with strings (e.g.,pite.held("Space")).Declarative Descriptors:
pite.child("Name")(PyChildDescriptor) andpite.node("../Path")(PyNodeDescriptor).NodeProxyinstances in_descriptor_cacheon first access to avoid repeated lookups.NodeProxy Caching & Hybrid Signals:
ScriptHost::proxy_cachecaches resolvedNodeProxyobjects by(caller, path).Button.pressed,Timer.timeout,Area2Dentry/exit) remain engine-dispatched.Enhanced Error Handling & Pause-On-Error:
GameSession::pause_on_errorcaptures formatted stack traces and script locations.self.playing = false), logs formatted tracebacks, and opens the offending script.Verification
cargo fmt --all -- --checkpassed.cargo build --workspace --lockedpassed.cargo test --workspace --lockedpassed (all crates includingpite-runtime,pite-script,pite-core,pite-editor).cargo run --locked -p pite-cli -- checkpassed.