Skip to main content

Composable toolkit for clean, testable, and maintainable Python applications

Project description

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
# or
pip install building-blocks

⚡ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

building_blocks_toolkit-0.3.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

building_blocks_toolkit-0.3.2-py3-none-any.whl (46.0 kB view details)

Uploaded Python 3

File details

Details for the file building_blocks_toolkit-0.3.2.tar.gz.

File metadata

  • Download URL: building_blocks_toolkit-0.3.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for building_blocks_toolkit-0.3.2.tar.gz
Algorithm Hash digest
SHA256 3ca23a36cceca19e17011f05c57f5596ea157ecc8262b371fb06db357d740bd2
MD5 2270b48eebcff78eec0c36cb2ad6d32f
BLAKE2b-256 30dcff762e763a8fbec0345e115c50f4c83e417e8a169781323d330bcc089ab2

See more details on using hashes here.

Provenance

The following attestation bundles were made for building_blocks_toolkit-0.3.2.tar.gz:

Publisher: publish.yml on building-blocks-org/building-blocks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file building_blocks_toolkit-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for building_blocks_toolkit-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3eedab420105d22405800e8df9ade59bf4e7edba4e2dcf7f44ca2ffe17d6da45
MD5 b62b394497a21ebd162c9576ee945965
BLAKE2b-256 0cde87a2a3a04d92ef003049436e6084cc2075c8f1b36f6459b0f29adfb90907

See more details on using hashes here.

Provenance

The following attestation bundles were made for building_blocks_toolkit-0.3.2-py3-none-any.whl:

Publisher: publish.yml on building-blocks-org/building-blocks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page