Skip to main content

BuildingBlocks 🧩

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

Python Poetry Type checked: mypy Code style: black Security: bandit


🌱 What Is BuildingBlocks?

Not a framework — a toolkit of composable contracts and abstractions.

BuildingBlocks 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 building blocks for designing software with intent and clarity.

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 Idea

Foundations, not frameworks. You choose the architecture — BuildingBlocks provides the language.

This toolkit defines layer-agnostic foundations that compose into any design:

  • Result, Ok, Err → explicit success/failure handling
  • Port, InboundPort, OutboundPort → communication boundaries
  • Entity, ValueObject, AggregateRoot → domain modeling
  • Repository, UnitOfWork → persistence contracts
  • Event, EventBus, CommandHandler → messaging and orchestration

🚀 Installation

poetry add building-blocks-toolkit
# or
pip install building-blocks-toolkit

⚡ Quick Example

from building_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


🧠 Why It Matters

Most systems fail not because of missing features, but because of tight coupling, implicit dependencies, and unclear responsibilities.

BuildingBlocks helps you design code intentionally — so that your system remains testable, extensible, and adaptable as it grows.


💡 Examples

Educational examples are being migrated to a dedicated repository (coming soon). They include both good practices and intentional anti-patterns to teach design reasoning.


🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md for environment setup and workflow.


⚖️ License

MIT — see LICENSE


Built with ❤️ by Glauber Brennon and the Building Blocks community.

Metadata

Release files for building-blocks-toolkit 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for building-blocks-toolkit 0.3.5
File Size Uploaded Provenance Actions
building_blocks_toolkit-0.3.5.tar.gz 32.8 kB With provenance Details for building_blocks_toolkit-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for building-blocks-toolkit 0.3.5
File Interpreter ABI Platform Actions
building_blocks_toolkit-0.3.5-py3-none-any.whl Python 3 none any Details for building_blocks_toolkit-0.3.5-py3-none-any.whl

Total release size: 78.7 kB

Release files / building_blocks_toolkit-0.3.5.tar.gz

Download URL building_blocks_toolkit-0.3.5.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dda88cbaa53b216259e5dbebe9b3706f2c136b896a7bd1beccdb3eb05e596c1c
BLAKE2b-256 checksum
How to use checksums
c3a89eeccafafdeca93f94ccc119bee99618749aa4e2428ef84cad421a4a3b0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2025.

Transparency log

Release files / building_blocks_toolkit-0.3.5-py3-none-any.whl

Download URL building_blocks_toolkit-0.3.5-py3-none-any.whl
Size 46.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c78052a4b925d74f422116f886e63cafbf364a68c9cfa24d310b7f2af0c9ab10
BLAKE2b-256 checksum
How to use checksums
b9825ddd923d727682389003efbcb7e39575379d2195a90678294170ce51a802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2025.

Transparency log

Security for building-blocks-toolkit 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for building_blocks_toolkit-0.3.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page