Skip to main content

🛡️ Hexaqual

PyPI version Python 3.13+ License: Apache 2.0

Universal Python quality gates, architectural boundary enforcement, and release engineering toolchain.

Hexaqual provides an opinionated, high-velocity quality harness designed for modular Python architectures, monorepos, and single-package projects. It unifies linting, type-checking, cognitive complexity enforcement, __all__ integrity, 1:1 test symmetry, and automated PyPI release workflows into a cohesive, workflow-driven developer CLI.


🚀 Key Features

  • Workflow-Driven Sanity Checks: Multi-stage DAG pipeline powered by Hexaflow for parallel linting, typechecking, and testing.
  • Architectural Invariants: First-class support for hexagonal layer enforcement (domain, ports, adapters, infra).
  • Test Parity Enforcement: 1:1 symmetry verification between source modules and unit test suites.
  • Public API Integrity: Automatic sorting, deduplication, and AST validation of __all__ exports.
  • Smart PyPI Publishing: Dependency-ordered, reproducible builds with automatic skip-if-exists checks.

📦 Installation

# Add as a development dependency
uv add --dev hexaqual

# Or install globally
uv tool install hexaqual

🛠️ Unified CLI (hexaqual)

Hexaqual subsumes all developer quality tools into a single unified entrypoint (hexaqual). It dynamically detects workspace layout:

  • Multi-package workspaces (packages/ exists): accepts -p / --package to filter focus across packages, or -a / --all for the whole workspace.
  • Single-package projects (no packages/): automatically focuses on the root package without requiring -p.
  • Examples support: if an examples/ directory exists, -e / --example allows targeted auditing of example projects.

Command Overview

Command Subcommands Description
hexaqual check (alias: sanity) Run the multi-stage quality pipeline (Ruff, Ty, Complexipy, __all__, test parity, pytest).
hexaqual statements check, fix Audit and auto-format __all__ exports with strict casefold sorting.
hexaqual parity test, extras Audit 1:1 symmetry between source modules and unit tests, and optional extras forwarding.
hexaqual test run, boundary, redundancy, impact Run pytest suites, boundary assertion audits, redundancy analysis, and git impact tests.
hexaqual mutate run, inspect Execute mutation testing via mutmut and inspect critical surviving mutants.
hexaqual release build, check, publish Build sdist/wheel distributions, verify metadata, and publish to PyPI with smart duplicate skipping.
hexaqual gh pr, checks, repo, security, code-scanning Inspect PR health dashboards, CI checks, repo governance, Dependabot, and CodeQL alerts.
hexaqual docs usage Verify and regenerate USAGE.md catalogs with dynamic subcommand tree unrolling.
# Run sanity checks on specific packages in a workspace
hexaqual check -p core -p cqrs

# Run sanity check with auto-formatting on a single-package repo
hexaqual check --fix

# Audit __all__ integrity across all packages
hexaqual statements check

# Run pytest on tests impacted by recent git changes
hexaqual test impact

# Examine a GitHub Pull Request dashboard with live polling
hexaqual gh pr 42 --watch

# Verify USAGE.md catalog is up to date
hexaqual docs usage --check

For the complete unrolled CLI reference and full option listings for every subcommand, see USAGE.md.


🪝 Pre-Commit Integration

Add Hexaqual to your .pre-commit-config.yaml to enforce all static quality gates in under a second:

repos:
  - repo: local
    hooks:
      - id: hexaqual-sanity
        name: hexaqual sanity check
        entry: uv run hexaqual sanity --skip-tests
        language: system
        pass_filenames: false

🐕 Dogfooding Hexaflow: Workflows as Architecture

Hexaqual serves as the primary real-world dogfooding ground for Hexaflow, demonstrating how lightweight, in-memory workflow DAGs can orchestrate high-performance developer tooling without complexity or latency.

The Sanity Workflow DAG

Rather than executing checks in a rigid, monolithic sequence or maintaining ad-hoc shell orchestration, hexaqual sanity compiles each target's verification into a declarative hexaflow.Workflow:

graph LR
    subgraph stage1 ["Stage 1: Leaf Static Checks"]
        Lint["Ruff Lint & Format"]
        Statements["__all__ Integrity"]
        Parity["1:1 Test Symmetry"]
    end

    subgraph stage2 ["Stage 2: Static Analysis"]
        Typecheck["Ty Typecheck"]
        Complexity["Cognitive Complexity <= 25"]
    end

    subgraph stage3 ["Stage 3: Dynamic Verification"]
        Pytest["Pytest Test Suites"]
    end

    Lint --> Typecheck
    Statements --> Typecheck
    Parity --> Complexity
    Typecheck --> Pytest
    Complexity --> Pytest

Why Dogfooding Hexaflow Matters:

  1. Deterministic Staging & Fail-Fast: Ultra-fast leaf AST checks (Ruff, __all__, test symmetry) execute in Stage 1 (~0.05s), providing immediate feedback before heavier static analysis (Ty, complexipy) or test suites run.
  2. Granular Step Checkpoints: Each verification step executes within a discrete StepContext, recording execution metrics, structured findings, and pass/fail states into an InMemoryStateStore.
  3. Zero-Latency Overhead: Hexaflow's minimal runtime footprint adds virtually zero overhead—the entire 5-stage static check pipeline runs in under 0.6 seconds.
  4. Resilient Error Isolation: If a step fails, the workflow gracefully preserves partial reports, enabling the Rich presenter to render complete multi-target dashboards showing exact failure context.

🏛️ Architecture & Documentation


📄 License

Apache-2.0. See LICENSE for details.

Download files

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

Source Distribution

hexaqual-0.2.1.tar.gz (269.0 kB view details)

Uploaded Source

Built Distribution

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

hexaqual-0.2.1-py3-none-any.whl (203.6 kB view details)

Uploaded Python 3

File details

Details for the file hexaqual-0.2.1.tar.gz.

File metadata

  • Download URL: hexaqual-0.2.1.tar.gz
  • Upload date:
  • Size: 269.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hexaqual-0.2.1.tar.gz
Algorithm Hash digest
SHA256 566879397e6d548f192048c188da42ce10801d23d81b304e70da1040a191d046
MD5 19b7588df3a5b04c359255876afdae31
BLAKE2b-256 b65c607b9dc0d13e5f13f4cea640998deb7efdcb32acd36bcdf491b296777ea2

See more details on using hashes here.

File details

Details for the file hexaqual-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: hexaqual-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 203.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hexaqual-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d03cb796b80b5b5607f821b5e6ce66bb4648d977970dda4abaafddc94e7c578b
MD5 9cddbae6582e1632417801e34d351012
BLAKE2b-256 bd5a8744380a6fd6e4abd991fbcf5eec5997ff294993895ff719708447bde22c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 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