Skip to main content

python-hexagonal

python-hexagonal is a library for building hexagonal applications in Python. The real usage story lives in src/example and the proof lives in src/tests/use_cases, so this documentation starts there instead of pretending a two-line snippet is enough.

Start here

What you learn from the first path

After the first-app guide you should understand:

  • where the domain model lives and why it stays isolated
  • how application APIs wrap command, query, and event buses
  • how ports describe the infrastructure your app needs
  • how entrypoints assemble an app from environment and infrastructure
  • how the use-case tests prove the workflow end to end

The blueprint we actually trust

These files are the baseline for the supported adoption story:

  • src/example/contacto/domain/contacto.py - aggregate behavior, value-object strategy, and query entry points
  • src/example/contacto/application/app.py - application composition through BusAppGroup
  • src/example/contacto/ports/drivens.py - infrastructure contracts and repository boundaries
  • src/example/app/application/api.py - top-level API wrapper consumers call
  • src/example/app/entrypoints/main.py - environment-driven bootstrap via EntrypointGroup
  • src/example/app/entrypoints/db/sqlalchemy.py - SQLAlchemy-specific infrastructure assembly
  • src/tests/use_cases/base.py - canonical test bootstrap with migrations, entrypoint creation, and topic registration

Supported path vs internals

The documented path is intentionally narrow.

  • Start from hexagonal.domain, hexagonal.application, hexagonal.ports.drivens, hexagonal.ports.drivers, and hexagonal.entrypoints
  • Reach for hexagonal.integrations.sqlalchemy when you need the reusable SQLAlchemy repository and unit-of-work utilities
  • Treat scoped execution as the default mental model: shared datastore and mapper, fresh write/read scope per operation
  • Treat hexagonal.entrypoints.sqlalchemy as adapter-specific convenience, not the whole framework story
  • Do not treat hexagonal.__init__ as the public integration surface; right now it only exposes hello()
  • Do not cargo-cult example names like exampleAPI, exampleEntrypoint, or Exampletate; copy the roles, not the labels
  • Do not build new code against hexagonal.adapters.*; that path is kept for compatibility, while the supported SQLAlchemy extension surface now lives under hexagonal.integrations.sqlalchemy

Companion skill

This repo also ships an installable companion skill at skills/python-hexagonal-usage/SKILL.md. It is there to inspect a user repository, map it to the same architecture, and point people back to the written docs. It does NOT replace the docs and it does NOT get to invent new supported APIs.

Metadata

Release files for python-hexagonal 0.3.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-hexagonal 0.3.2
File Size Uploaded Provenance Actions
python_hexagonal-0.3.2.tar.gz 42.0 kB With provenance Details for python_hexagonal-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-hexagonal 0.3.2
File Interpreter ABI Platform Actions
python_hexagonal-0.3.2-py3-none-any.whl Python 3 none any Details for python_hexagonal-0.3.2-py3-none-any.whl

Total release size: 113.2 kB

Release files / python_hexagonal-0.3.2.tar.gz

Download URL python_hexagonal-0.3.2.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a609d8dc9de8608c2ef4e2253a19c34feb30644918a3f2a7986a18a7df30ef9e
BLAKE2b-256 checksum
How to use checksums
a0914ce0d4759b57bab36cff3f5968be8d8d7f4a1f46ee754ffa394b45a06d9d
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 Mar 21, 2026.

Transparency log

Release files / python_hexagonal-0.3.2-py3-none-any.whl

Download URL python_hexagonal-0.3.2-py3-none-any.whl
Size 71.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7f4a410310b79215982be95838dc7f2659a0d5f042f0e3bfd28a7dd088247e8
BLAKE2b-256 checksum
How to use checksums
f97138488128f7aa5abc95ebfed32f5cf978bf49c271d60762b3b3d1e86463a5
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 Mar 21, 2026.

Transparency log

Security for python-hexagonal 0.3.2

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 python_hexagonal-0.3.2.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 Mar 21, 2026.

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.

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