Skip to main content

Hexagonal Sanity Check

This project checks if the dependency flow between the layers of the Hexagonal architecture defined for this project was respected.

How to install

It can be easily installed via pip: pip install hexagonal-sanity-check

How to configure your project

First it's necessary to define your hexagonal layers and their order. The tool expects a default file name on your source folder dir with the name hexagonal_config.py.

  1. First you create the Hexagonal Layers you have on your system via the class name HexagonalLayer. There are two arguments:

    • name: It can be any name, domain, frontend, infrastructure, or any name you used for your layers.
    • usecases: This is the name of the directory the files related to this layer as storage. It's not the full path, it's the directory name relative path from source.
  2. Import hexagonal_config on your file, and define the order with + (add layers) then >>(set the sequence of the layers). The most to the left layers is the most outer layer, while the most to the right layer is the most inner layer.

Example, for this folder structure:

. src
├── __init__.py
├── hexagonal_config.py
├── domain
│   ├── __init__.py
│   ├── __pycache__
│   └── person.py
├── infrastructure
│   ├── __init__.py
│   └── person_mysql_repository.py
├── main.py
├── services
│   ├── __init__.py
│   └── person_repository.py
└── usecases
    ├── __init__.py
    └── create_person_usecase.py
.tests    

The file:

from hexagonal.domain.hexagonal_layer import HexagonalLayer
from hexagonal.hexagonal_config import hexagonal_config

hexagonal_config.add_inner_layer(HexagonalLayer(name='infrastructure', directories=['/infrastructure']))
hexagonal_config.add_inner_layer(HexagonalLayer(name='use_cases', directories=['/use_cases']))
hexagonal_config.add_inner_layer(HexagonalLayer(name='services', directories=['/services']))
hexagonal_config.add_inner_layer(HexagonalLayer(name='domain', directories=['/domain']))

hexagonal_config.excluded_dirs = ['/tests']

Generating the Project Diagram

This command generate a visual diagram show the composition of your hexagonal layers.

Pre requisites

To generate the Hexagonal Diagram of the project, it's necessary to have Graphviz installed in the machine.
For Mac you can brew install graphviz.
For other, check the documentation https://graphviz.org/download/.

CMD

hexagonal diagram --source_path ./

Checking Project's Hexagonal Integrity

This checks if the correct flow of the dependencies -from outer to inner layer- was respected.

CMD

hexagonal check --source_path ./

Metadata

Release files for hexagonal-sanity-check 0.0.21

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

Source distribution (sdist)

Source distribution for hexagonal-sanity-check 0.0.21
File Size Uploaded
hexagonal-sanity-check-0.0.21.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hexagonal-sanity-check 0.0.21
File Interpreter ABI Platform
hexagonal_sanity_check-0.0.21-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / hexagonal-sanity-check-0.0.21.tar.gz

Download URL hexagonal-sanity-check-0.0.21.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
294569b78f2058d23d7b3b8ea809f632eaa9faa80b001dec166731b32f2e1669
BLAKE2b-256 checksum
How to use checksums
2f9b10ac002eacb8bcad353e258987630582c393c92c99cea230cf383a0f6987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1021-azure

Release files / hexagonal_sanity_check-0.0.21-py3-none-any.whl

Download URL hexagonal_sanity_check-0.0.21-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57e86f5e159c54c87049314f91bd5564258a46c73873e74e9ca2d381534af748
BLAKE2b-256 checksum
How to use checksums
da8c48229bd7c2e70fa4eeec1cb7902cbf3f0d2d5a9a83ff9ce599ee494ad309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1021-azure

Release history Release notifications | RSS feed

This release

0.0.21 This release

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.1

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