Skip to main content

python-seedwork

PyPI version Python License: MIT CI codecov Ruff Checked with pyright

DDD and Hexagonal Architecture building blocks for Python.

Goals

  • Unify design patterns. Provide a shared vocabulary — entities, aggregates, value objects, domain events, CQRS buses — so every bounded context starts from the same foundation.
  • Keep domain logic pure. The domain layer has zero framework or infrastructure imports. Business rules live in the domain; everything else lives in infrastructure.
  • Clear layer boundaries. Protocols define contracts; implementations satisfy them structurally. The dependency direction is enforced: domain ← application ← infrastructure.

Components

Layer Package Components
Domain seedwork.domain Entity, AggregateRoot, ValueObject, DomainEvent, DomainEventRecord, DomainError, Repository, UnitOfWork
Application seedwork.application Command, Query[TResult], CommandHandler, QueryHandler, CommandBus, QueryBus, Result, DomainEventBusPublisher, DomainEventBusSubscriber, DomainEventBus, DomainEventHandler, BaseIntegrationEvent[TPayload], IntegrationEvent[TPayload], IntegrationEventPublisher, IntegrationEventHandler, BackgroundTask[TPayload], TaskScheduler
Infrastructure seedwork.infrastructure RegistryCommandBus, RegistryQueryBus, TransactionalCommandBus, DomainEventCoordinatorCommandBus, CommandBusBuilder, QueryBusBuilder, DeferredDomainEventBus, DomainEventPublishingRepository, InMemoryRepository

All components are also re-exported from the top-level seedwork package.

Installation

pip install python-seedwork

Requires Python 3.12+. Ships a py.typed marker (PEP 561) — mypy and pyright pick up the inline types automatically.

Documentation

Comprehensive guides are available in the docs/ directory:

A complete Bank Account example demonstrates all patterns end-to-end.

Requirements

Python 3.12+, uv

Built With

Development

git clone https://github.com/aseguragonzalez/python-seedwork.git
cd python-seedwork
make install
Command Description
make check Lint, typecheck, and tests (what CI runs)
make lint Run ruff linter
make format Format and auto-fix with ruff
make typecheck Run pyright
make test Run tests with coverage (90% gate)
make test-no-cov Run tests without coverage
make clean Remove build artifacts and caches

Contributing

This project follows the Conventional Commits specification. The commit-msg pre-commit hook enforces the format; python-semantic-release derives versions and the changelog from commit prefixes automatically.

References

This package draws on the following literature and on the experience of building solid, scalable, and maintainable systems in different stacks (PHP, C#, Python, TypeScript).

  • Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software 1
  • Vaughn Vernon, Implementing Domain-Driven Design 2
  • Robert C. Martin, Clean Architecture: A Craftsman's Guide to Software Structure and Design 3
  • .NET Microservices: Architecture for Containerized .NET Applications 4
  • Architecture Patterns with Python, Harry Percival & Bob Gregory 5

License

MIT

Metadata

Release files for python-seedwork 1.1.2

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

Source distribution (sdist)

Source distribution for python-seedwork 1.1.2
File Size Uploaded
python_seedwork-1.1.2.tar.gz 157.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-seedwork 1.1.2
File Interpreter ABI Platform
python_seedwork-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 180.2 kB

Release files / python_seedwork-1.1.2.tar.gz

Download URL python_seedwork-1.1.2.tar.gz
Size 157.9 kB
Tags Source
SHA-256 checksum
How to use checksums
08276e1502e794799f99bd9353f665e93b54b10f76d4406306c06a1d6bfb12f7
BLAKE2b-256 checksum
How to use checksums
738c626d976456450eee2fd29fbb7cd77600a3cea901857223bcda1358881e88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Release files / python_seedwork-1.1.2-py3-none-any.whl

Download URL python_seedwork-1.1.2-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2beb294ec7e8069a13f0c7d6982d42de83c2e6e12b4c84e7d4012c34495dc06e
BLAKE2b-256 checksum
How to use checksums
aaf0d4ea8d6f6f9ea81230c6bd5b14e83f7d4c7905dc680c1cbebac12069ed69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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