Skip to main content

A modular application framework with built-in FastAPI integration and pluggable services

Project description

ProcessPype

CI codecov Python 3.13+ PyPI License: MIT Docs

A modular application framework for building service-oriented Python applications with built-in FastAPI integration, structured logging, and pluggable services.

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
  • 📦 Pluggable Services: Built-in clock, database, storage, notification, and monitoring services — add your own with a single class
  • 🌐 REST API: Application-level endpoints for service discovery, registration, and lifecycle management
  • 📊 Structured Logging: Integrated Logfire support for production-grade observability
  • 🔒 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.core.application import Application
from processpype.core.configuration.models import ApplicationConfiguration
from processpype.core.service.service import Service
from processpype.core.service.manager import ServiceManager
from processpype.core.configuration.models import 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 = ApplicationConfiguration(title="Hello App", 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.create(config_file): Load configuration from YAML and create an instance
    • 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: Pydantic-validated models loaded 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-1.2.1.tar.gz (173.2 kB view details)

Uploaded Source

Built Distribution

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

processpype-1.2.1-py3-none-any.whl (75.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: processpype-1.2.1.tar.gz
  • Upload date:
  • Size: 173.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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-1.2.1.tar.gz
Algorithm Hash digest
SHA256 4bd3ab9fc3ce41f3c1236a1efee71c450c0f73f2888d4a32a4eb55a73bb67f68
MD5 020b358b7eae6741e1c281f4141271d8
BLAKE2b-256 7b91715b4ee91f20f8f66192fc02528105e166aeae7a98c01b2284f6a4442bb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: processpype-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 75.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e881ca2469d3d5cc75bebfc107e21ea28e3d226d7f0bb676da4c6d4ae043757
MD5 d66ac0e35e861e8286105a39f8d86bcf
BLAKE2b-256 fd9c42334480981158d44c4ebc8d10c37f5e486083d9864f822c89f6e0898eee

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