Skip to content

Repository files navigation

ForgingBlocks

Composable abstractions and interfaces for writing clean, testable, and maintainable Python code.

Python Poetry Type checked: mypy Code style: ruff Security: bandit CI


Overview

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.


Installation

pip install forging-blocks          # pip
poetry add forging-blocks           # Poetry
uv add forging-blocks               # uv

Requires Python 3.14+


Quick Example

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"

Documentation


License

MIT — see LICENSE


ForgingBlocks — foundations for clean, testable, and maintainable Python architectures.

About

Not a framework, a toolkit!

Resources

Contributing

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages