thisisthepy
Ecosystem생태계 / Projects프로젝트 / pythonx-graphics
pythonx

pythonx-graphics

Declarative 2D and 3D graphics for Python: Compose for 2D, Filament for 3D, and scenes built for AI agents.Python을 위한 선언형 2D·3D 그래픽스: 2D는 Compose, 3D는 Filament, 그리고 AI 에이전트를 위한 장면.

GitHub · Spec

Overview개요

pythonx-graphics is a declarative 2D and 3D graphics library for Python apps on every platform: Compose (Skia) for 2D, Filament for 3D, one state model for both, and a scene that AI agents can work on as well as people.

pythonx-graphics는 모든 플랫폼의 Python 앱을 위한 선언형 2D·3D 그래픽스 라이브러리입니다. 2D는 Compose(Skia), 3D는 Filament이고, 상태 모델은 하나이며, 장면은 사람뿐 아니라 AI 에이전트도 다룰 수 있게 설계합니다.

The problem it solves푸는 문제

three.js made 3D on the web approachable by putting a scene graph over a GPU API. Python apps have no equivalent that runs natively on phones. A raw GPU abstraction such as wgpu is fast on the GPU but leaves the whole scene layer to be written, and pays a validation cost per call on the CPU. And no graphics library today is designed for agents: a model can look at a frame, but it cannot ask what is in it, point at an object, or change it safely.

three.js는 GPU API 위에 장면 그래프를 얹어 웹의 3D를 쉽게 만들었습니다. Python 앱에는 휴대폰에서 네이티브로 도는 그런 것이 없습니다. wgpu 같은 GPU 추상화는 GPU에서는 빠르지만 장면 계층 전체를 직접 써야 하고, CPU에서는 호출마다 검증 비용을 냅니다. 그리고 오늘의 그래픽스 라이브러리는 에이전트를 위해 설계되지 않았습니다. 모델은 프레임을 볼 수는 있지만, 무엇이 있는지 묻거나, 물체를 가리키거나, 안전하게 바꿀 수는 없습니다.

How it works동작 방식

Scene3D(camera=Camera(position=(0, 1.5, 4), look_at=(0, 0, 0)), content=lambda: {
    Sun(intensity=100_000, direction=(-1, -1, -1)),
    Model("models/chair.glb", name="chair", tags={"furniture"},
          behaviours=[Spin(axis=(0, 1, 0), speed=angle_speed)]),
    Box(size=(4, 0.1, 4), name="floor", static=True),
})
  • One model. A 3D scene is a Compose composition whose nodes are Filament entities, through a Compose Applier. Compose HUDs sit over 3D views and share state.
  • Motion is data. Tweens, springs, paths, physics and constraints run natively every frame; Python runs on events. Per-frame logic that must be Python is compiled by TypedPython. Ten thousand instances come from one array.
  • The scene is a document. Stable ids, a JSON schema, round-trip to the Python declaration.
Scene3D(camera=Camera(position=(0, 1.5, 4), look_at=(0, 0, 0)), content=lambda: {
    Sun(intensity=100_000, direction=(-1, -1, -1)),
    Model("models/chair.glb", name="chair", tags={"furniture"},
          behaviours=[Spin(axis=(0, 1, 0), speed=angle_speed)]),
    Box(size=(4, 0.1, 4), name="floor", static=True),
})
  • 모델 하나. 3D 장면은 Compose Applier를 통해 노드가 Filament 엔티티인 Compose 컴포지션입니다. Compose HUD가 3D 화면 위에 겹치고 상태를 함께 씁니다.
  • 움직임은 데이터. 트윈, 스프링, 경로, 물리, 제약을 네이티브가 매 프레임 실행하고, Python은 이벤트에서만 돕니다. 매 프레임 Python이어야 하는 로직은 TypedPython이 컴파일합니다. 인스턴스 1만 개는 배열 하나에서 나옵니다.
  • 장면은 문서. 안정적인 ID, JSON 스키마, Python 선언과의 왕복.

Design decisions설계 결정

  • Filament for 3D: a scene-level, physically based renderer at the height of three.js, with Vulkan, Metal and OpenGL backends and an official Android API, Apache-2.0.
  • Compose for 2D, the same Skia canvas the UI uses.
  • No Python on the frame path by default, enforced by a measurement test.
  • Agents are first-class users, not an afterthought.
  • 3D는 Filament. three.js와 같은 높이의 장면 수준 물리 기반 렌더러이고, Vulkan, Metal, OpenGL 백엔드와 공식 Android API가 있으며 Apache-2.0입니다.
  • 2D는 Compose. UI가 쓰는 같은 Skia 캔버스입니다.
  • 기본적으로 프레임 경로에 Python 없음. 측정 테스트로 강제합니다.
  • 에이전트가 일급 사용자. 나중에 붙이는 기능이 아닙니다.

Where it fits생태계 안의 위치

It extends pythonx-compose's model to 3D, uses TypedPython for compiled per-frame logic, pythonx-concurrent for asset loading and agent loops, and optionally torchnative for local generative asset providers.

pythonx-compose의 모델을 3D로 넓히고, 매 프레임 로직은 TypedPython으로 컴파일하고, 에셋 로딩과 에이전트 루프는 pythonx-concurrent로 돌리고, 로컬 생성형 에셋 제공자로 torchnative를 선택적으로 씁니다.

Where it stands현재 상태

Specified, name reserved on PyPI. Implementation in the pythonx turn.

스펙 완료, PyPI 이름 선점. 구현은 pythonx 차례에 합니다.

Future design미래 설계

Agentic graphics

  • Describe and query: summaries for language models with spatial relations computed from bounds (on top of, left of, inside, near).
  • Ground: each captured frame comes with an entity-id buffer and depth, so "the red chair" in an image becomes a node.
  • Edit safely: transactions validated against schemas and app-defined constraints, previewed, undoable, and emitted as source patches to the declaration.
  • Tools: tool schemas generated from the components for any agent framework.
  • Evaluate: headless, deterministic rendering with a fixed clock and seed; recording and replay of sessions.

에이전틱 그래픽스

  • 설명과 질의: 경계 상자로 계산한 공간 관계(위, 왼쪽, 안, 가까이)가 들어간 언어 모델용 요약.
  • 연결: 캡처한 프레임마다 엔티티 ID 버퍼와 깊이가 함께 나와서 이미지 속 "빨간 의자"가 노드가 됩니다.
  • 안전한 수정: 스키마와 앱이 정한 제약으로 검증하고, 미리 보고, 되돌릴 수 있고, 선언에 대한 소스 패치로 나오는 트랜잭션.
  • 도구: 컴포넌트에서 생성하는 도구 스키마를 어떤 에이전트 프레임워크에든 줍니다.
  • 평가: 고정 시계와 시드로 창 없이 결정적으로 렌더링하고, 세션을 기록하고 재생합니다.

Roadmap로드맵

After pythonx-compose's beta, in the order of the ecosystem roadmap.

pythonx-compose 베타 뒤, 생태계 로드맵 순서대로.