Composable abstractions and interfaces for writing clean, testable, and maintainable Python code.
Not a framework — a toolkit of composable contracts and abstractions.
ForgingBlocks provides layer-agnostic foundations for clean architecture in Python: Result for explicit error handling, ValueObject for domain modeling, ports and adapters for dependency inversion, and more. Use what you need; ignore the rest. It doesn't dictate your architecture — it gives you the language to define one.
pip install forging-blocks # pip
poetry add forging-blocks # Poetry
uv add forging-blocks # uvRequires Python 3.14+
from forging_blocks.foundation import Result, Ok, Err
def divide(a: float, b: float) -> Result[float, str]:
if b == 0:
return Err("Don't divide by zero")
return Ok(a / b)
result = divide(10, 2).map(lambda n: f"Result: {n}")
print(result.value) # "Result: 5.0"- Full Documentation
- Getting Started
- Blocks Overview
- Architecture Overview
- Testing Guide
- API Reference
- Contributing Guide
- Release Guide
MIT — see LICENSE
ForgingBlocks — foundations for clean, testable, and maintainable Python architectures.