Input, Result와 데이터 타입 계약
현재 실행 가능한 port 작성법과 후속 data contract를 구분해 확인합니다.
구현 상태 · contract_only 경계
현재 공개 pipelinexlab.px facade는 px.Results, px.Record, px.Settings와 metadata marker px.input, px.result, px.setting 및 생성 결과용 px.Artifact.from_bytes를 제공합니다. @px.record, px.field, px.Table과 외부 파일 입력용 Artifact reader는 planned입니다. 이 미구현 기능의 계획 예제를 현재 설치본에서 실행할 API로 해석하지 않습니다.
현재 사용할 port 문법
Function·Component input은 일반 Python parameter annotation으로, 이름 있는 result는 px.Results subclass의 annotated field로 선언합니다.
from pipelinexlab import px
class UtilizationResults(px.Results):
utilization: float
@px.function(
key="calculate_utilization",
version="1.0.0",
description="Calculates demand-to-resistance utilization.",
)
def calculate_utilization(
demand: float,
resistance: float,
) -> UtilizationResults:
return UtilizationResults(utilization=demand / resistance)Flow public boundary는 flow.input("port_key", ValueType, ...)과 flow.result("port_key", source, ...)가 직접 선언합니다. target parameter의 이름과 annotation이 Node input port를, px.Results field의 이름과 annotation이 Node result port를 정합니다.
문법별 구현 상태
| 이름 | 현재 상태 | 현재 사용할 문법 |
|---|---|---|
px.Results | current | subclass의 annotated field로 named result 선언 |
px.input | current | parameter 기본값 자리의 description·unit·required marker |
px.result | current | px.Results field 기본값 자리의 description·unit marker |
px.setting | current | px.Settings field의 component-declared-settings@1 선언 |
px.Record | current | subclass의 annotated field로 record schema 선언 |
@px.record, px.field | contract_only · planned | px.Record subclass의 annotated field |
px.Table | contract_only · planned | 지원되는 원소 annotation의 list[T] |
px.Artifact.from_bytes | implemented · 생성 결과 | PNG·binary bytes 반환. 외부 파일 입력 reader는 planned |
px.input과 px.result
두 marker는 unit과 description을 선언부에 결합합니다. value type은 annotation이 소유하며 marker는 이를 바꾸지 않습니다.
px.input(*, description, unit=None, required=True)
px.result(*, description, unit=None)px.input(...)은 target parameter에만 사용합니다.px.result(...)은px.Resultsfield에만 사용합니다.- Flow public input/result는 marker가 아니라 current
flow.input(...)과flow.result(...)가 계속 소유합니다.
Component settings
px.setting은 px.Settings subclass의 field 하나가 선언하는 description, unit, requiredness와 default를 states하는 component-declared-settings@1 문법입니다. @px.component(..., settings=BeamSettings)로 선언한 setting은 선언당 최대 8개까지 받고, host control registry가 선언된 closed type에서 control을 그리며 package code는 평가하지 않습니다. flow.node(..., settings={...})의 non-empty object는 그 exact Component 선언에 대조해 판정하고, 선언이 없는 기존 V1 wire는 호환을 위해 raw 값으로 그대로 읽습니다.
계획된 Record와 Table
@px.record와 px.field는 구조화 값 schema, px.Table[RecordType]은 같은 Record schema의 여러 row를 하나의 typed value로 전달할 후속 계약입니다.
@px.record(record_key, *, description, row_key=None)
px.field(*, description, unit=None, constraints=None, default=px.REQUIRED)
px.Table[RecordType]현재 facade는 이 세 이름을 export하지 않습니다. 여러 field를 한 값으로 묶는 current 문법은 px.Record subclass의 annotated field이고, current collection port에는 지원되는 원소 annotation의 list[T]를 사용하며 list 전체가 값 하나이므로 target은 한 번 실행됩니다. 여러 scalar case를 각각 실행하는 Batch와 collection value 하나를 전달하는 Run을 구분합니다.
계획된 Artifact value
계획된 외부 파일 입력 reader는 media type, digest, 권한과 provenance를 가진 immutable external-object reference를 위한 planned public type입니다. 현재 facade에는 이 타입이나 동등한 public artifact input marker가 없습니다. 로컬 path 문자열이나 제한 없는 raw bytes를 임시 대체 API로 문서화하지 않으며, versioned Artifact contract와 bounded reader가 함께 제공될 때 current 상태로 전환합니다.