# pyrophone.nodes

*module*

Reusable node implementations built on the public component model.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L1-L1)

## pyrophone.nodes.JSONValue

*attribute*

```python
JSONValue
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L11-L13)

## pyrophone.nodes.Identity

*class*

```python
class Identity(Transform[T, T])
```

Bases: ``

Forward each value unchanged, preserving its type and object identity.

Register a concrete subclass, such as Identity[int], with node_type.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L69-L76)

### pyrophone.nodes.Identity.transform

*method* · *async*

```python
async def transform(value: T) -> T
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L75-L76)

## pyrophone.nodes.IdentityBytes

*class*

```python
class IdentityBytes(Identity[bytes])
```

Bases: ``

Pass byte payloads through unchanged.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L79-L81)

## pyrophone.nodes.JSONTransform

*class*

```python
class JSONTransform(Transform[bytes, bytes])
```

Bases: ``

Decode JSON, transform its value, and encode the result as UTF-8 bytes.

Override transform_json(); ports remain byte-oriented for direct connection
to transports such as MQTT. Encoding uses compact JSON with Unicode text
preserved and rejects non-finite numbers. Codec and hook errors propagate
through the normal node failure contract.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L128-L147)

### pyrophone.nodes.JSONTransform.transform

*method* · *async*

```python
async def transform(payload: bytes) -> bytes
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L137-L142)

### pyrophone.nodes.JSONTransform.transform_json

*method* · *async*

```python
async def transform_json(value: JSONValue) -> JSONValue
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L144-L147)

## pyrophone.nodes.Print

*class*

```python
class Print(Transform[T, T])
```

Bases: ``

Print each value to stdout and forward it unchanged.

Uses Python's normal print formatting and flushes each line immediately.
Register a concrete subclass such as Print[int] with node_type.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L84-L93)

### pyrophone.nodes.Print.transform

*method* · *async*

```python
async def transform(value: T) -> T
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L91-L93)

## pyrophone.nodes.PrintBytes

*class*

```python
class PrintBytes(Print[bytes])
```

Bases: ``

Print byte payloads (including the b prefix) without decoding them.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L96-L98)

## pyrophone.nodes.PrintText

*class*

```python
class PrintText(Transform[str | bytes, str | bytes])
```

Bases: ``

Print text or UTF-8 bytes and forward the original value unchanged.

Invalid UTF-8 prints as a bytes repr. Each print flushes stdout immediately.
The graph infers the output type from the connected upstream port.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L101-L125)

### pyrophone.nodes.PrintText.transform

*method* · *async*

```python
async def transform(value: str | bytes) -> str | bytes
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L117-L125)

## pyrophone.nodes.Sink

*class*

```python
class Sink(Node)
```

Bases: `pyrophone._node.Node`

Consume values from one input port in stream order.

Override consume() and register a concrete subclass with node_type.
Each call finishes before the next input is received.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L34-L48)

### pyrophone.nodes.Sink.in_port

*attribute* · *class attribute* · *instance attribute*

```python
in_port = Input[T](description='Values to consume.')
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L41-L41)

### pyrophone.nodes.Sink.consume

*method* · *async*

```python
async def consume(value: T) -> None
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L47-L48)

### pyrophone.nodes.Sink.run

*method* · *async*

```python
async def run() -> None
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L43-L45)

### pyrophone.nodes.Sink.print

*method*

```python
def print(file: TextIO | None = None) -> None
```

Inherited from: `pyrophone._inspection.Printable`

Write a pretty multiline description, followed by a newline.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/_inspection.py#L13-L15)

## pyrophone.nodes.Source

*class*

```python
class Source(Node)
```

Bases: `pyrophone._node.Node`

Send the values from an async generator through one output port.

Override produce() and register a concrete subclass with node_type.
The next value is requested after the current send is accepted.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L16-L31)

### pyrophone.nodes.Source.out_port

*attribute* · *class attribute* · *instance attribute*

```python
out_port = Output[T](description='Produced values.')
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L23-L23)

### pyrophone.nodes.Source.produce

*method*

```python
def produce() -> AsyncGenerator[T, None]
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L30-L31)

### pyrophone.nodes.Source.run

*method* · *async*

```python
async def run() -> None
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L25-L28)

### pyrophone.nodes.Source.print

*method*

```python
def print(file: TextIO | None = None) -> None
```

Inherited from: `pyrophone._inspection.Printable`

Write a pretty multiline description, followed by a newline.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/_inspection.py#L13-L15)

## pyrophone.nodes.Transform

*class*

```python
class Transform(Node)
```

Bases: `pyrophone._node.Node`

Transform each input value into one output value, in stream order.

Override transform() and register a concrete subclass with node_type.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L51-L66)

### pyrophone.nodes.Transform.in_port

*attribute* · *class attribute* · *instance attribute*

```python
in_port = Input[InputT](description='Values to transform.')
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L57-L57)

### pyrophone.nodes.Transform.out_port

*attribute* · *class attribute* · *instance attribute*

```python
out_port = Output[OutputT](description='Transformed values.')
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L58-L58)

### pyrophone.nodes.Transform.run

*method* · *async*

```python
async def run() -> None
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L60-L63)

### pyrophone.nodes.Transform.transform

*method* · *async*

```python
async def transform(value: InputT) -> OutputT
```

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/nodes.py#L65-L66)

### pyrophone.nodes.Transform.print

*method*

```python
def print(file: TextIO | None = None) -> None
```

Inherited from: `pyrophone._inspection.Printable`

Write a pretty multiline description, followed by a newline.

[View source](https://github.com/messier-42/pyrophone/blob/f5e0987fb765db19a311f3cf3827e765495bdbb5/src/pyrophone/_inspection.py#L13-L15)
