Skip to main content

A modular process environment framework: observability, server, and services — all driven by YAML config

Project description

ProcessPype

CI codecov Python 3.13+ PyPI License: MIT Docs

A modular application framework for building service-oriented Python applications with FastAPI integration, structured logging, and a clear service lifecycle.

Features

  • Service Framework: Define services with a clear lifecycle (initialize, configure, start, stop) and automatic REST API endpoints
  • FastAPI Integration: Each service automatically gets HTTP endpoints for status, start, stop, and configuration
  • Configuration Management: YAML file, environment variable, and programmatic configuration with Pydantic models
  • Pure Framework: No built-in services — provides the infrastructure for building your own with clear patterns and examples
  • REST API: Application-level endpoints for service discovery, registration, and lifecycle management
  • Observability: Structured logging with multiple formatters (JSON, color, text), log redaction, and OpenTelemetry tracing support (Logfire, OTLP gRPC/HTTP, console)
  • Type Safe: Fully typed with MyPy strict mode
  • Well Tested: Comprehensive test suite with high coverage

Installation

# Using pip
pip install processpype

# Using uv
uv add processpype

Quick Start

import asyncio
from processpype import Application, ProcessPypeConfig, Service, ServiceManager, ServiceConfiguration


class GreeterManager(ServiceManager):
    async def start(self) -> None:
        self.logger.info("Greeter ready")

    async def stop(self) -> None:
        self.logger.info("Greeter stopped")


class GreeterService(Service):
    configuration_class = ServiceConfiguration

    def create_manager(self) -> GreeterManager:
        return GreeterManager(self.logger)

    def requires_configuration(self) -> bool:
        return False


async def main() -> None:
    config = ProcessPypeConfig(
        app={"title": "Hello App"},
        server={"port": 8080},
    )
    async with Application(config) as app:
        await app.initialize()
        service = app.register_service(GreeterService)
        await app.start_service(service.name)


asyncio.run(main())

Core Components

  • Application: Central orchestrator that manages the FastAPI server, configuration, and service lifecycle

    • Application(config): Create an instance with a ProcessPypeConfig
    • app.register_service(ServiceClass): Register and wire a service into the application
    • app.start_service(name) / app.stop_service(name): Lifecycle control
  • Service: Abstract base class for all services — implement create_manager() and optionally create_router()

    • Automatic REST endpoints: GET /services/{name}, POST /services/{name}/start, POST /services/{name}/stop
    • Built-in state machine: INITIALIZED → CONFIGURED → STARTING → RUNNING → STOPPING → STOPPED
  • ServiceManager: Handles business logic for a service — implement start() and stop()

  • Configuration: Hierarchical ProcessPypeConfig with app, server, and logging sections — Pydantic-validated, loadable from YAML files, environment variables, or kwargs

Documentation

Full documentation is available at gianlucapagliara.github.io/processpype.

Development

ProcessPype uses uv for dependency management and packaging:

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run type checks
uv run mypy processpype

# Run linting
uv run ruff check .

# Run pre-commit hooks
uv run pre-commit run --all-files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

processpype-2.1.3.tar.gz (170.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

processpype-2.1.3-py3-none-any.whl (56.0 kB view details)

Uploaded Python 3

File details

Details for the file processpype-2.1.3.tar.gz.

File metadata

  • Download URL: processpype-2.1.3.tar.gz
  • Upload date:
  • Size: 170.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for processpype-2.1.3.tar.gz
Algorithm Hash digest
SHA256 d6e039d7647591ddc9feb0a05be1b0e27fad1e801d36b4d4bcac672618bb860c
MD5 8fe25d0f4910876149f68246bdb99672
BLAKE2b-256 b1f2286069fc2e8ee38deb4efd00104ea015815b9d5c5a1e51eec9af615a5284

See more details on using hashes here.

File details

Details for the file processpype-2.1.3-py3-none-any.whl.

File metadata

  • Download URL: processpype-2.1.3-py3-none-any.whl
  • Upload date:
  • Size: 56.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for processpype-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d2bbb2bb40fd7e8d7c9f62edbcb6af1a4a04d597da920c57092d03ab4ded5f66
MD5 fb5411afc242a424a82fd0f361342354
BLAKE2b-256 9e81d632c9a55cf8d4d36735008a3eb8475671a806f6a4feba1110dfbdcf8ef3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page