Skip to content
github-actions[bot] edited this page Nov 2, 2026 · 3 revisions

interpose

Shared mechanism for metalayerlab interceptors — a policy-configurable async middleware pipeline, the layered settings loader, Secret values, and Prometheus text exposition.

interpose is a small Python library for metalayerlab's interceptors (mitm-proxy, sluice), which depend on a GitHub release tag. It has three components: the pipeline, settings (with secrets) and metrics.

Pipeline

One middleware loop, interpose.pipeline: the project keeps its own hooks and unit of work, and fail open or closed is policy, per project and per middleware.

Settings

interpose.settings and interpose.secret. Each setting is declared once and read from a _FILE variable, the environment, a YAML file or its default, with strict types and a record of where each value came from:

from pathlib import Path

from interpose.settings import Setting, Settings, port

SETTINGS = Settings(
    "MYAPP_",
    (Setting("listen.port", 8080, "Port.", check=port),),
    default_path=Path("/etc/myapp/config.yaml"),
)
r = SETTINGS.resolve(environ={"MYAPP_LISTEN_PORT": "9090"})
assert (r.values["listen.port"], r.sources["listen.port"]) == (9090, "MYAPP_LISTEN_PORT")

Metrics

Prometheus text exposition, interpose.metrics, with every label's values declared up front. The project serves the text.

Table of Contents

Getting started: Introduction · Quick Start

Using it: API Reference Help: Troubleshooting · FAQ · Security

Developers: Contributing · Architecture Internals · Testing Guide · Release Process

interpose

GitHub • Releases


📚 Getting Started

📖 Core Concepts

🔒 Security

🆘 Help & Support

🧑‍💻 For Developers


🔑 Key Features

  • 🧅 One middleware loop; fail open or closed is policy, per project and per middleware
  • 🥞 One lookup order: _FILE > environment > YAML > default
  • 🧱 Strict types: no silent 0 for a YAML 0.5
  • 🧭 Where each value came from, for every setting
  • 🔒 Secret: masked in logs, reprs and errors
  • 📈 Prometheus text with labels from declared value sets

Clone this wiki locally