Composable toolkit for clean, testable, and maintainable Python applications
Project description
ForgingBlocks
Composable abstractions and interfaces for writing clean, testable, and maintainable Python code.
🌱 Overview
Not a framework — a toolkit of composable contracts and abstractions.
ForgingBlocks helps you create codebases that are:
- Clean — with clear boundaries and intent
- Testable — by design, through explicit interfaces
- Maintainable — by isolating concerns and dependencies
It doesn’t dictate your architecture. Instead, it provides foundations and reusable abstractions for forging your own blocks.
Isolate external concerns from your core logic you will achieve systems that are adaptable and resilient. If you forge your own block you will achieve software with intent and clarity If you use blocks you will achieve consistency and reusability. ForgingBlocks helps you build systems that last.
You can use it to:
- Learn and apply architecture and design principles
- Build decoupled applications that scale safely
- Model systems with type safety and explicit intent
- Experiment with Clean, Hexagonal, DDD, or Message-Driven styles
🧩 Core Concepts
Foundations, not frameworks — ForgingBlocks provides the language for clean architecture.
This toolkit defines layer-agnostic foundations that compose into any design:
Result,Ok,Err→ explicit success/failure handlingPort,InboundPort,OutboundPort→ communication boundariesEntity,ValueObject,AggregateRoot→ domain modelingRepository,UnitOfWork→ persistence contractsEvent,MessageBus,CommandHandler→ messaging and orchestration
🚀 Installation
poetry add forging-blocks
# or
pip install forging-blocks
# or
uv add forging-blocks
Requires Python 3.14+
⚡ Quick Example
from forging_blocks.foundation import Result, Ok, Err
def divide(a: int, b: int) -> Result[int, str]:
if b == 0:
return Err("division by zero")
return Ok(a // b)
result = divide(10, 2)
if result.is_ok:
print(result.value) # → 5
📚 Learn More
- 📘 Documentation
- 🚀 Getting Started Guide
- 🏗️ Architecture Overview
- 🧱 Principles & Guidelines
- 🧩 Release Process
🛠️ Development
Prerequisites
- Python 3.14+
- Poetry for dependency management
Setup
# Clone the repository
git clone https://github.com/forging-blocks-org/forging-blocks.git
cd forging-blocks
# Install dependencies
poetry install
# Run tests
poetry run poe test
# Run full CI suite
poetry run poe ci:check
Available Commands
# Testing - Primary Commands
poetry run poe test # Run ALL tests (recommended)
poetry run poe test:unit # Run unit tests only (fast feedback)
poetry run poe test:integration # Run integration tests only
poetry run poe test:e2e # Run end-to-end tests only
# Testing - Alternative Commands
poetry run poe test:debug # Run tests with verbose output
# Code quality
poetry run poe lint # Check code style
poetry run poe lint:fix # Fix code style issues
poetry run poe type # Type checking
poetry run poe bandit # Security scanning
# Documentation
poetry run poe docs:build # Build documentation
poetry run poe docs:generate # Generate API reference
# Release (maintainers)
poetry run poe release patch # Test release (simulation)
poetry run poe release patch --execute # Execute patch release
🧪 Test Architecture
This project uses a 3-tier testing architecture:
- Unit Tests (
@pytest.mark.unit) - Fast, isolated tests with mocks or fakes - Integration Tests (
@pytest.mark.integration) - Real infrastructure in isolated environments - End-to-End Tests (
@pytest.mark.e2e) - Complete workflows (mostly skipped)
Quick feedback during development:
poetry run poe test:unit # ⚡ Fast (~1s) - run frequently
Verify integrations before commits:
poetry run poe test # 🔍 Complete test suite (~3s) - run before commits
See Testing Guide for detailed information.
🧠 Why It Matters
Most systems fail not because of missing features, but because of tight coupling, implicit dependencies, and unclear responsibilities.
ForgingBlocks helps you design code intentionally — so your system remains testable, extensible, and adaptable as it grows.
🤝 Contributing
Contributions are welcome! 🎉
- Fork the repository
- Install dependencies:
poetry install - Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run the full test suite:
poetry run poe ci:check - Submit a pull request with a clear description
See CONTRIBUTING.md for detailed guidelines.
Release Process
For maintainers preparing releases:
# Prepare release (safe simulation)
poetry run poe release patch
# Execute release (creates branch and PR)
poetry run poe release patch --execute
See RELEASE_GUIDE.md for complete release instructions.
⚖️ License
MIT — see LICENSE
ForgingBlocks — foundations for clean, testable, and maintainable Python architectures.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forging_blocks-0.4.1.tar.gz.
File metadata
- Download URL: forging_blocks-0.4.1.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f3549755346f07471c969e6172697a1249180e6a5a76868242888460dec045b
|
|
| MD5 |
a62e88d5af27de7be1c56e967a7884bc
|
|
| BLAKE2b-256 |
de8e714017b001b8446fa30cc6d72bf0bf6d46ee93f8cde6f02766d096b7f213
|
Provenance
The following attestation bundles were made for forging_blocks-0.4.1.tar.gz:
Publisher:
release.yml on forging-blocks-org/forging-blocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forging_blocks-0.4.1.tar.gz -
Subject digest:
0f3549755346f07471c969e6172697a1249180e6a5a76868242888460dec045b - Sigstore transparency entry: 1774890295
- Sigstore integration time:
-
Permalink:
forging-blocks-org/forging-blocks@40ce35b6bddf5d3f5e01f939447100b07b1faa98 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/forging-blocks-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@40ce35b6bddf5d3f5e01f939447100b07b1faa98 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file forging_blocks-0.4.1-py3-none-any.whl.
File metadata
- Download URL: forging_blocks-0.4.1-py3-none-any.whl
- Upload date:
- Size: 61.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d45f1b4742450195323ba698c53c56e991fcd7f6f9afc126881875548959b195
|
|
| MD5 |
da7709e1bc59a9fbff6e6a5c204cb1bd
|
|
| BLAKE2b-256 |
a7e9697b25027802770408bcc103e320c2c6ee69bcab7125eec3cdf6811bb14f
|
Provenance
The following attestation bundles were made for forging_blocks-0.4.1-py3-none-any.whl:
Publisher:
release.yml on forging-blocks-org/forging-blocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
forging_blocks-0.4.1-py3-none-any.whl -
Subject digest:
d45f1b4742450195323ba698c53c56e991fcd7f6f9afc126881875548959b195 - Sigstore transparency entry: 1774890492
- Sigstore integration time:
-
Permalink:
forging-blocks-org/forging-blocks@40ce35b6bddf5d3f5e01f939447100b07b1faa98 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/forging-blocks-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@40ce35b6bddf5d3f5e01f939447100b07b1faa98 -
Trigger Event:
pull_request
-
Statement type: