본문으로 건너뛰기

@px.component

@px.component는 Component declaration과 결합할 수 있는 key·port shape의 Python companion symbol을 등록할 때 Component 제작자가 사용합니다.

현재 구현 범위

decorator는 ComponentDescriptor metadata만 등록합니다. content/component.json이나 Python executor를 생성하지 않으며, decorator에서 설치 가능한 container로 이어지는 packaging bridge도 아직 없습니다. 별도로 작성한 V1 declaration과 execute(inputs, settings) executor는 내부 reader/fixture 검증에만 사용합니다. production Flow reader는 saved Component를 read-only unsupported로 표시하며 package의 live Node body·modal·label 또는 전체 contract snapshot을 읽지 않습니다. Component contribution 저장·catalog·detail·worker data path는 exact Project scope를 적용하지만, 요청 scope를 authenticated principal의 Project 권한에 결속하지 않으며 installer에는 안전한 inactive quarantine도 없습니다. production third-party Component install admission과 activation은 authorization·execution-trust closure와 명시적인 production gate가 모두 구현될 때까지 차단합니다.

무엇을 만드나요?

현재 descriptor는 componentKey, label·description, 선택적 category/subcategory와 annotation에서 파생한 typed input/result만 등록합니다. setting schema, executor와 presentation은 포함하지 않습니다. exact release resolution과 production placement는 Project authorization과 execution-trust closure 뒤의 successor workflow입니다.

Studio에서는 어디에 보이나요?

현재 production Components Dock에서 검색·배치할 수 있는 것은 등록된 built-in type입니다. Project-scoped repository query는 구현됐지만 설치한 contribution을 production Dock에 연결하는 공개 discovery·placement bridge는 아직 없습니다. 기존 V1 artifact가 exact target을 저장한 경우 현재 Studio에는 exact 7-field target/raw settings와 연결 사용처에서 유도한 일부 port만 가진 read-only unsupported Component Node로 보입니다. package가 제공하는 Node body와 설정 modal은 V2에 포함되지 않습니다. 향후 presentation 계약은 host-owned component.declarative@2만 정의하며, rich UI는 RFC-016의 component-rich-surface-declaration@1이 소유합니다.

문법

python
@px.component(*, key, label, description, category=None, subcategory=None)

최소 예제

python
from pipelinexlab import px


class BadgeResults(px.Results):
    text: str


@px.component(
    key="result_badge",
    label="Result badge",
    description="Displays a number as a compact badge.",
    category="review",
    subcategory="metrics",
)
def result_badge(
    value: float,
) -> BadgeResults:
    ...  # metadata companion symbol; the V1 fixture executor is a separate file

다음은 V1 wire/internal fixture가 보존하는 placement shape입니다. production third-party 설치·배치·실행 예제가 아닙니다.

python
from pipelinexlab import px
from result_tools.components import result_badge


flow = px.Flow(
    "result_summary",
    label="Result summary",
    description="Displays a formatted calculation result.",
)
badge = flow.node(
    "utilization_badge",
    result_badge,
    settings={"precision": 2},
)

매개변수

이름설명
keyComponent를 참조하는 stable lower_snake_case 이름
labelComponents와 Node에 표시할 이름
descriptionComponent가 하는 일을 설명하는 문장
categoryComponent가 수행하는 주작업. 생략하거나 input, transform, calculate, review, deliver, control 여섯 개 중 하나을 씁니다
subcategorycategory 안에서 publisher가 직접 정하는 선택적 lower_snake_case key

Python 함수 이름은 companion symbol입니다. SDK descriptor identity는 명시한 key가 소유하고, input은 parameter annotation에서, result는 px.Results annotation에서 읽습니다. V1 internal resolution과 future post-closure execution의 exact identity는 resolver가 반환한 publisher, package key/version/digests, component key와 componentContractVersion의 결합입니다.

반환값과 handle

Decorated symbol은 import할 수 있는 Component companion 이름입니다. V1 internal fixture는 materialized exact declaration과 local descriptor의 input/result key set이 같을 때 placement handle shape를 만들 수 있습니다. production에서 flow.node(...)가 third-party Component를 resolve·배치하는 경로는 두 closure 전까지 열지 않습니다.

규칙과 진단

  • key, labeldescription은 필수입니다.
  • Python 구현 symbol을 바꿔도 key가 같으면 Component identity는 유지됩니다.
  • category는 닫힌 primary task registry입니다. input, transform, calculate, review, deliver, control 여섯 개 중 하나만 쓰고, 그 밖의 값은 decoration에서 거부합니다. 같은 여섯 key를 packaged Component declaration도 씁니다.
  • subcategory는 별개 축입니다. 닫힌 category 아래에서 publisher가 직접 정하는 열린 lower_snake_case key이며, category가 있을 때만 사용합니다.
  • categorysubcategory는 표시 문구가 아니라 stable lower_snake_case key입니다.
  • 현재 public SDK는 px.setting(...), px.input(...), px.result(...) marker를 제공합니다. annotation이 port shape를 만들고 marker가 description·unit·required를 더하며, settings=로 붙인 px.Settings subclass의 field가 ComponentDescriptorsettings 선언이 됩니다. flow.node(..., settings={...})의 값은 그 선언에 대조해 판정합니다.
  • 선언이 없는 기존 settings object는 V1 호환으로 그대로 보존합니다. 후속 V2 Canvas는 host-owned component.declarative@2만 사용하고 settings를 component-declared-settings@1로 선언당 최대 8개까지 받고 host control registry가 그립니다. rich surface는 RFC-016의 component-rich-surface-declaration@1이 소유합니다.
  • 현재 installer는 trust authority 없이 signed Component를 기록하지 않고, 명시적으로 수용한 unsigned Component만 absent·not-checked로 기록합니다. exact ProjectScope data-path isolation은 구현됐지만 Project authorization과 execution-trust closure가 닫히기 전에는 third-party install admission과 activation을 허용하지 않습니다.
  • 한 Python distribution은 Component symbol을 여러 개 export할 수 있지만, portable V1 container 하나에는 content/component.json declaration 하나만 있습니다. 다중 선언은 contract-only V2입니다.
  • Component를 import하거나 decorator를 선언하는 것만으로 Canvas Node가 생기지 않습니다.
  • supported first-party/internal execution에서 처리하지 못한 실패는 PX_COMPONENT_FAILED 진단으로 정규화됩니다. 이 code는 third-party production activation 권한을 뜻하지 않습니다.

다음