Metadata-Version: 2.4
Name: infraclass
Version: 1.0.1
Summary: Infraclass is a lightweight, zero-dependency, and highly secure hierarchical inventory compiler for Python automation engines (like ansible and pyinfra). It allows you to build inventories using a top-down class inheritance layout, natively supporting encrypted secrets using age.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pyyaml>=6.0

# Infraclass

Infraclass is a lightweight, zero-dependency, and highly secure hierarchical inventory compiler for Python automation engines (like ansible and pyinfra). It allows you to build inventories using a top-down class inheritance layout, natively supporting encrypted secrets using age.

Project Directory Structure

Infraclass separates the core execution configuration from your static data inventory. Rename your data directory to infraclass/ to align with the framework:

pyinfra/
├── inventory.py               # Calls infraclass to generate the pyinfra inventory
├── deploy.py                  # Your execution playbooks
└── infraclass/                # Your hierarchical data directory
    ├── classes/               # Reusable configuration blueprints
    │   ├── components/
    │   ├── platform/
    │   │   └── init.yml       # Standard shared properties & secrets
    │   └── roles/
    └── nodes/                 # Machine-specific inventory targets
        └── example.com.yml

To make the infraclass binary globally active and accessible to your local pyinfra execution pass:

Install the Package: Install infraclass cleanly using uv (or pip):

uv tool install infraclass --with PyYAML

Verify Default Path Alignment: By default, infraclass checks for an encrypted key at ~/.age/identity.age. Ensure your encrypted private key file sits exactly at that path.
Optional Environment Overrides: If you need to map to a different key file variant, export the override directly in your shell profile (~/.zshrc):

export INFRACLASS_AGE_KEY_FILE="$HOME/.age/identity.age"

"Out of the Box" Verification Tests
Once these parameters are lined up, you have two native testing options to confirm the engine is happy:

Test 1: Standard Standalone CLI Output
infraclass example.com
Success Criteria: Full flat hierarchical YAML prints straight to stdout, with all custom !secret blocks transformed into decrypted, human-readable strings.

Test 2: In-Memory Python Engine Integration
from infraclass.compiler import compile_node_data

node_data = compile_node_data("netsys-dev-smc2.lancs.ac.uk")

Read variable directly out of compiled parameters mapping tree
secret_pass = node_data["parameters"]["platform"]["psql"]["database-name"]["password"]
print(f"Decrypted password token: {secret_pass}")

