Skip to main content

ezmsg-baseproc

Base processor classes and protocols for building message-processing components in ezmsg.

Installation

pip install ezmsg-baseproc

Or install the latest development version:

pip install git+https://github.com/ezmsg-org/ezmsg-baseproc@dev

Overview

ezmsg-baseproc provides abstract base classes for creating message processors that can be used both standalone and within ezmsg pipelines. The package offers a consistent pattern for building:

  • Protocols - Type definitions for processors, transformers, consumers, and producers
  • Processors - Transform input messages to output messages
  • Producers - Generate output messages without requiring input
  • Consumers - Accept input messages without producing output
  • Transformers - A specific type of processor with typed input/output
  • Stateful variants - Processors that maintain state across invocations
  • Adaptive transformers - Transformers that can be trained via partial_fit
  • Composite processors - Chain multiple processors together efficiently

All base classes support both synchronous and asynchronous operation, making them suitable for offline analysis and real-time streaming applications.

Usage

Creating a Simple Transformer

from dataclasses import dataclass
from ezmsg.baseproc import BaseTransformer
from ezmsg.util.messages.axisarray import AxisArray, replace

@dataclass
class MySettings:
    scale: float = 1.0

class MyTransformer(BaseTransformer[MySettings, AxisArray, AxisArray]):
    def _process(self, message: AxisArray) -> AxisArray:
        return replace(message, data=message.data * self.settings.scale)

Creating a Stateful Transformer

from ezmsg.baseproc import BaseStatefulTransformer, processor_state

@processor_state
class MyState:
    count: int = 0
    hash: int = -1

class MyStatefulTransformer(BaseStatefulTransformer[MySettings, AxisArray, AxisArray, MyState]):
    def _reset_state(self, message: AxisArray) -> None:
        self._state.count = 0

    def _process(self, message: AxisArray) -> AxisArray:
        self._state.count += 1
        return message

Creating an ezmsg Unit

from ezmsg.baseproc import BaseTransformerUnit

class MyUnit(BaseTransformerUnit[MySettings, AxisArray, AxisArray, MyTransformer]):
    SETTINGS = MySettings
    # That's all - the base class handles everything else!

Development

We use uv for development.

  1. Install uv if not already installed
  2. Clone and cd into the repository
  3. Run uv sync to create a .venv and install dependencies
  4. Run uv run pytest tests to run tests
  5. (Optional) Install pre-commit hooks: uv run pre-commit install

License

MIT License - see LICENSE for details.

Metadata

Release files for ezmsg-baseproc 1.19.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezmsg-baseproc 1.19.0
File Size Uploaded Provenance Actions
ezmsg_baseproc-1.19.0.tar.gz 101.0 kB Without provenance Details for ezmsg_baseproc-1.19.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ezmsg-baseproc 1.19.0
File Interpreter ABI Platform Actions
ezmsg_baseproc-1.19.0-py3-none-any.whl Python 3 none any Details for ezmsg_baseproc-1.19.0-py3-none-any.whl

Total release size: 160.5 kB

Release files / ezmsg_baseproc-1.19.0.tar.gz

Download URL ezmsg_baseproc-1.19.0.tar.gz
Size 101.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f6a320096ae03309a7e194f84bb2c3b9f4074b8cca90ddf7b7d6c8f611eb01c9
BLAKE2b-256 checksum
How to use checksums
9314a2a254396f6a602304be40a3bbd90e4ae52a0ca09f6c83d5be195c29dba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ezmsg_baseproc-1.19.0-py3-none-any.whl

Download URL ezmsg_baseproc-1.19.0-py3-none-any.whl
Size 59.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b43e87b9c7e41336824f1f3a4e51c7b82171a46c14b0fdee752586ffba403653
BLAKE2b-256 checksum
How to use checksums
1be61e14ed55c6f2bfd07e35bb9111e652b3579b2643262a0c5db3ce0ab20fe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ezmsg-baseproc 1.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page