ProcessPype

CI codecov Python 3.13+ PyPI License: MIT

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 and automatic REST API endpoints
  • FastAPI Integration --- Each service automatically exposes HTTP endpoints for status, start, stop, and configuration
  • Configuration Management --- YAML file, environment variable, and programmatic configuration with Pydantic models
  • Secrets Management --- Multi-backend secrets framework supporting environment variables, YAML files, dotenv files, and AWS Secrets Manager with prefix support and glob patterns
  • 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 compliance
  • Well Tested --- Comprehensive test suite with high coverage

Quick Example

import asyncio
from processpype import Application, ProcessPypeConfig
from processpype.examples import HelloService


async def main() -> None:
    config = ProcessPypeConfig(
        app={"title": "My App"},
        server={"port": 8080},
    )
    async with Application(config) as app:
        await app.initialize()
        service = app.register_service(HelloService)
        await app.start_service(service.name)
        print(f"Service state: {service.status.state}")


asyncio.run(main())

Architecture Overview

ProcessPype is organized around three core abstractions:

  • Application orchestrates the FastAPI server, configuration loading, and service lifecycle. Instantiate directly with ProcessPypeConfig.
  • Service is the unit of work. Each service has a manager (business logic) and a router (HTTP API). Implement create_manager() to define what your service does.
  • ServiceManager implements the actual start() and stop() logic for a service.
Application
├── ProcessPypeConfig     ── hierarchical app/server/logging config
├── ApplicationManager    ── service registry and lifecycle
├── ApplicationRouter     ── REST API for the application
└── Service (per service)
    ├── ServiceManager    ── business logic (start/stop)
    └── ServiceRouter     ── HTTP endpoints per service

ProcessPype is a pure framework --- it provides the infrastructure for building services but does not ship any built-in service implementations. See the example services in processpype.examples for ready-made templates.

Next Steps